summaryrefslogtreecommitdiffstats
path: root/win/C#/frmMain.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2010-04-30 19:57:05 +0000
committersr55 <[email protected]>2010-04-30 19:57:05 +0000
commitc1d2b77d9e0c0bdb37da785be22059832fc507a5 (patch)
tree6af7a04ecd472e7fe781a4b7f108d69522e9889a /win/C#/frmMain.cs
parent5694491f9710ae41db4e24055c14f56ad6682589 (diff)
WinGui:
- Kill the CLI on GUI close for Scanning and fixed for encoding. - Fixed Autoname bug where it would strip all slashes out the path git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3279 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/frmMain.cs')
-rw-r--r--win/C#/frmMain.cs45
1 files changed, 24 insertions, 21 deletions
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 50a4c8ef6..0b89a573b 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -1783,23 +1783,13 @@ namespace Handbrake
private void KillScan()
{
- try
- {
- SourceScan.ScanCompleted -= new EventHandler(SourceScan_ScanCompleted);
- EnableGUI();
- ResetGUI();
+ SourceScan.ScanCompleted -= new EventHandler(SourceScan_ScanCompleted);
+ EnableGUI();
+ ResetGUI();
- if (SourceScan.ScanProcess() != null)
- SourceScan.ScanProcess().Kill();
+ SourceScan.KillScan();
- lbl_encode.Text = "Scan Cancelled!";
- }
- catch (Exception ex)
- {
- MessageBox.Show(
- "Unable to kill HandBrakeCLI.exe \nYou may need to manually kill HandBrakeCLI.exe using the Windows Task Manager if it does not close automatically within the next few minutes. \n\nError Information: \n" +
- ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
+ lbl_encode.Text = "Scan Cancelled!";
}
private void ResetGUI()
@@ -1987,9 +1977,9 @@ namespace Handbrake
/// <summary>
/// Handle GUI shortcuts
/// </summary>
- /// <param name="msg"></param>
- /// <param name="keyData"></param>
- /// <returns></returns>
+ /// <param name="msg">Message</param>
+ /// <param name="keyData">Keys</param>
+ /// <returns>Bool</returns>
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Control | Keys.S))
@@ -2009,18 +1999,31 @@ namespace Handbrake
/// <summary>
/// If the queue is being processed, prompt the user to confirm application close.
/// </summary>
- /// <param name="e"></param>
+ /// <param name="e">FormClosingEventArgs</param>
protected override void OnFormClosing(FormClosingEventArgs e)
{
// If currently encoding, the queue isn't paused, and there are queue items to process, prompt to confirm close.
- if ((encodeQueue.IsEncoding) && (!encodeQueue.PauseRequested) && (encodeQueue.Count > 0))
+ if (encodeQueue.IsEncoding)
{
DialogResult result =
MessageBox.Show(
- "HandBrake has queue items to process. Closing HandBrake will not stop the current encoding, but will stop processing the queue.\n\nDo you want to close HandBrake?",
+ "HandBrake has queue items to process. Closing HandBrake will stop the current encoding.\n\nDo you want to close HandBrake?",
"Close HandBrake?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
+
if (result == DialogResult.No)
e.Cancel = true;
+
+ // Try to safely close out if we can, or kill the cli if using in-gui status
+ if (Settings.Default.enocdeStatusInGui)
+ encodeQueue.Stop();
+ else
+ encodeQueue.SafelyClose();
+ }
+
+ if (SourceScan.IsScanning)
+ {
+ SourceScan.ScanCompleted -= new EventHandler(SourceScan_ScanCompleted);
+ SourceScan.KillScan();
}
base.OnFormClosing(e);
}