summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2015-04-18 19:03:56 +0000
committersr55 <[email protected]>2015-04-18 19:03:56 +0000
commit8dbb216c9e01ca7102b24e8e5ebd09304a7ee0a9 (patch)
tree233e3bfa996cd0115d831f3353d0bc24a929b114
parent906ec1611817b6a0eb26f694f34aaacd13aabdbc (diff)
WinGui: Adding Del shortcut to preset pane, and better warnings when deleting.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7103 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs23
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml11
2 files changed, 34 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 7465ceb10..652068444 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -1638,6 +1638,29 @@ namespace HandBrakeWPF.ViewModels
{
if (this.selectedPreset != null)
{
+ if (this.selectedPreset.IsDefault)
+ {
+ this.errorService.ShowMessageBox(
+ "You can not delete the default preset. Please set another preset as default first.",
+ Resources.Warning,
+ MessageBoxButton.OK,
+ MessageBoxImage.Information);
+
+ return;
+ }
+
+ MessageBoxResult result =
+ this.errorService.ShowMessageBox(
+ "Are you sure you want to delete the preset: " + this.selectedPreset.Name + " ?",
+ Resources.Question,
+ MessageBoxButton.YesNo,
+ MessageBoxImage.Question);
+
+ if (result == MessageBoxResult.No)
+ {
+ return;
+ }
+
this.presetService.Remove(this.selectedPreset);
}
else
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml
index ba311ae59..7f4809d83 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml
@@ -4,6 +4,8 @@
xmlns:Controls="clr-namespace:HandBrakeWPF.Controls"
xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"
xmlns:Micro="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
+ xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
+ xmlns:commands="clr-namespace:HandBrakeWPF.Commands"
AllowDrop="True"
FontSize="11"
Micro:Message.Attach="[Event Loaded] = [Action Load]"
@@ -553,6 +555,15 @@
BorderBrush="LightGray"
>
+ <i:Interaction.Triggers>
+ <commands:InputBindingTrigger>
+ <commands:InputBindingTrigger.InputBinding>
+ <KeyBinding Key="Delete"/>
+ </commands:InputBindingTrigger.InputBinding>
+ <Micro:ActionMessage MethodName="PresetRemove" />
+ </commands:InputBindingTrigger>
+ </i:Interaction.Triggers>
+
<ListBox.GroupStyle>
<GroupStyle ContainerStyle="{StaticResource ContainerStyle}"/>
</ListBox.GroupStyle>