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 | |
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')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 45 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml | 7 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml.cs | 6 |
3 files changed, 48 insertions, 10 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
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index fd4f0d356..4b68d6b3e 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -8,6 +8,7 @@ FontSize="11" Background="#FFF0F0F0"
Micro:Message.Attach="[Event Loaded] = [Action Load]"
UseLayoutRounding="True" SizeToContent="Height"
+ WindowStartupLocation="CenterScreen"
SnapsToDevicePixels="True"
AllowDrop="True">
@@ -17,6 +18,12 @@ <Micro:Parameter Value="$eventArgs"></Micro:Parameter>
</Micro:ActionMessage>
</i:EventTrigger>
+
+ <i:EventTrigger EventName="Closing">
+ <Micro:ActionMessage MethodName="HandleWindowClosing">
+ <Micro:Parameter Value="$eventArgs"></Micro:Parameter>
+ </Micro:ActionMessage>
+ </i:EventTrigger>
</i:Interaction.Triggers>
<Window.Resources>
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs index 163a3d807..165e74923 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs @@ -9,7 +9,6 @@ namespace HandBrakeWPF.Views
{
- using System.Diagnostics;
using System.Windows;
/// <summary>
@@ -24,10 +23,5 @@ namespace HandBrakeWPF.Views {
InitializeComponent();
}
-
- private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
- {
- Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
- }
}
}
|