summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2010-06-25 19:46:38 +0000
committersr55 <[email protected]>2010-06-25 19:46:38 +0000
commitbfaada823e0b3efca709cf709ee1aa67fd4c4c60 (patch)
treedf25306109517e6dcaad599bb4d6e97c4353e88c
parent79cf721b8b77a102e481abfae2132fdaac0ccffd (diff)
WinGui:
- Allow files to be dropped on the GUI executable. (Including shortcuts). This will automatically try to scan the file. Users can add their own registry entries to add an "open with" if they choose. - Fixed an exception that occurs when a scanned file returns no titles. - Fixed an issue where pressing "No" to the on close warning (when encodes are running) would cancel the encode anyway. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3405 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/C#/Program.cs4
-rw-r--r--win/C#/frmMain.cs39
2 files changed, 30 insertions, 13 deletions
diff --git a/win/C#/Program.cs b/win/C#/Program.cs
index d5da8f2d1..19f5fb2cb 100644
--- a/win/C#/Program.cs
+++ b/win/C#/Program.cs
@@ -24,7 +24,7 @@ namespace Handbrake
/// The main entry point for the application.
/// </summary>
[STAThread]
- public static void Main()
+ public static void Main(string[] args)
{
// Handle any unhandled exceptions
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
@@ -79,7 +79,7 @@ namespace Handbrake
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new frmMain());
+ Application.Run(new frmMain(args));
}
}
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 713ca101c..1a7590b54 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -79,7 +79,13 @@ namespace Handbrake
#region Application Startup
- public frmMain()
+ /// <summary>
+ /// Initializes a new instance of the <see cref="frmMain"/> class.
+ /// </summary>
+ /// <param name="args">
+ /// The arguments passed in on application startup.
+ /// </param>
+ public frmMain(string[] args)
{
// Load and setup the splash screen in this thread
splash.Show(this);
@@ -168,6 +174,12 @@ namespace Handbrake
// Event Handlers and Queue Recovery
events();
queueRecovery();
+
+ // If have a file passed in via command arguemtents, check it's a file and try scanning it.
+ if (args.Length >= 1 && File.Exists(args[0]))
+ {
+ this.StartScan(args[0], 0);
+ }
}
private void UpdateCheckDone(IAsyncResult result)
@@ -2046,17 +2058,19 @@ namespace Handbrake
drp_dvdtitle.SelectedIndex = 0;
}
- // Enable the creation of chapter markers if the file is an image of a dvd.
- int start, end;
- int.TryParse(drop_chapterStart.Items[0].ToString(), out start);
- int.TryParse(drop_chapterFinish.Items[drop_chapterFinish.Items.Count - 1].ToString(), out end);
- if (end > start)
- Check_ChapterMarkers.Enabled = true;
- else
+ // Enable the creation of chapter markers if the file is an image of a dvd
+ if (drop_chapterStart.Items.Count > 0)
{
- Check_ChapterMarkers.Enabled = false;
- Check_ChapterMarkers.Checked = false;
- data_chpt.Rows.Clear();
+ int start, end;
+ int.TryParse(drop_chapterStart.Items[0].ToString(), out start);
+ int.TryParse(drop_chapterFinish.Items[drop_chapterFinish.Items.Count - 1].ToString(), out end);
+ if (end > start) Check_ChapterMarkers.Enabled = true;
+ else
+ {
+ Check_ChapterMarkers.Enabled = false;
+ Check_ChapterMarkers.Checked = false;
+ data_chpt.Rows.Clear();
+ }
}
// If no titles were found, Display an error message
@@ -2440,7 +2454,10 @@ namespace Handbrake
"Close HandBrake?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.No)
+ {
e.Cancel = true;
+ return;
+ }
// Try to safely close out if we can, or kill the cli if using in-gui status
if (Settings.Default.enocdeStatusInGui)