diff options
author | sr55 <[email protected]> | 2012-05-26 19:46:10 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-05-26 19:46:10 +0000 |
commit | 12c2588e4d281f4cc16683d211a6cb8a76b4b1d5 (patch) | |
tree | 0b044cda72e3bc33a783b66799845e512fa87b06 /win/CS/HandBrakeWPF/ViewModels | |
parent | e171cf6645d2d43e44ec40a3f5f918b6397580c7 (diff) |
WinGui: Add a warning when closing the app while an encode is running. A fix for the Browse button not updating the Output format dropdown correctly.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4703 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 71bf4c022..d8331354a 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -764,6 +764,29 @@ namespace HandBrakeWPF.ViewModels this.queueProcessor.EncodeService.EncodeStarted -= this.EncodeStarted;
this.queueProcessor.EncodeService.EncodeStatusChanged -= this.EncodeStatusChanged;
}
+
+ /// <summary>
+ /// Handle the Window Closing Event and warn the user if an encode is in-progress
+ /// </summary>
+ /// <param name="e">
+ /// The CancelEventArgs.
+ /// </param>
+ public void HandleWindowClosing(CancelEventArgs e)
+ {
+ if (this.encodeService.IsEncoding)
+ {
+ MessageBoxResult result = this.errorService.ShowMessageBox("HandBrake is currently encoding. Closing now will abort your encode.\nAre you sure you wish to exit?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning);
+ if (result == MessageBoxResult.No)
+ {
+ e.Cancel = true;
+ }
+ else
+ {
+ this.encodeService.Stop();
+ }
+ }
+ }
+
#endregion
#region Menu and Taskbar
@@ -1072,9 +1095,24 @@ namespace HandBrakeWPF.ViewModels };
dialog.ShowDialog();
- this.CurrentTask.Destination = dialog.FileName;
- this.NotifyOfPropertyChange("CurrentTask");
- this.SetExtension(Path.GetExtension(dialog.FileName));
+ if (!string.IsNullOrEmpty(dialog.FileName))
+ {
+ switch (Path.GetExtension(dialog.FileName))
+ {
+ case ".mkv":
+ this.SelectedOutputFormat = OutputFormat.Mkv;
+ break;
+ case ".mp4":
+ this.SelectedOutputFormat = OutputFormat.Mp4;
+ break;
+ case ".m4v":
+ this.SelectedOutputFormat = OutputFormat.M4V;
+ break;
+ }
+
+ this.CurrentTask.Destination = dialog.FileName;
+ this.NotifyOfPropertyChange(() => this.CurrentTask);
+ }
}
/// <summary>
@@ -1269,7 +1307,6 @@ namespace HandBrakeWPF.ViewModels this.CurrentTask.LargeFile = false;
this.CurrentTask.OptimizeMP4 = false;
this.CurrentTask.IPod5GSupport = false;
- this.selectedOutputFormat = OutputFormat.Mkv;
}
// Update The browse file extension display
|