diff options
Diffstat (limited to 'win/CS/HandBrakeWPF/Views/ShellView.xaml.cs')
-rw-r--r-- | win/CS/HandBrakeWPF/Views/ShellView.xaml.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs index cc6b381de..6b291702d 100644 --- a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs @@ -11,6 +11,8 @@ namespace HandBrakeWPF.Views {
using System.Windows;
+ using HandBrakeWPF.ViewModels.Interfaces;
+
/// <summary>
/// Interaction logic for ShellView.xaml
/// </summary>
@@ -23,5 +25,22 @@ namespace HandBrakeWPF.Views {
this.InitializeComponent();
}
+
+ /// <summary>
+ /// Check with the user before closing.
+ /// </summary>
+ /// <param name="e">
+ /// The CancelEventArgs.
+ /// </param>
+ protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
+ {
+ bool canClose = ((IShellViewModel)this.DataContext).CanClose();
+ if (!canClose)
+ {
+ e.Cancel = true;
+ }
+
+ base.OnClosing(e);
+ }
}
}
|