summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs45
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml7
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml.cs6
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));
- }
}
}