]> granicus.if.org Git - handbrake/commitdiff
WinGui: Fix an issue with the Add preset window that prevented it from updating exist...
authorsr55 <sr55.hb@outlook.com>
Fri, 18 May 2018 22:43:01 +0000 (23:43 +0100)
committersr55 <sr55.hb@outlook.com>
Fri, 18 May 2018 22:44:00 +0000 (23:44 +0100)
win/CS/HandBrakeWPF/Services/Presets/PresetService.cs
win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs

index a7d4dbefa27b184ff81217a2650166c7ae24f318..2182c082d610767fcee3b51d5564cc4e9fa27489 100644 (file)
@@ -159,6 +159,12 @@ namespace HandBrakeWPF.Services.Presets
                 {\r
                     this.SavePresetFiles();\r
                 }\r
+\r
+                return true;\r
+            }\r
+            else\r
+            {\r
+                this.Update(preset);\r
                 return true;\r
             }\r
 \r
index 398fff3c8ffefcee3ea183f243552d91fdb077a5..856c3e4bc3590578081c860d7ea3f465ed0f48e2 100644 (file)
@@ -236,7 +236,14 @@ namespace HandBrakeWPF.ViewModels
 \r
             if (this.presetService.CheckIfPresetExists(this.Preset.Name))\r
             {\r
-                MessageBoxResult result = this.errorService.ShowMessageBox(Resources.AddPresetViewModel_PresetWithSameNameOverwriteWarning, Resources.Error, MessageBoxButton.YesNo, MessageBoxImage.Error);\r
+                Preset currentPreset = this.presetService.GetPreset(this.Preset.Name);\r
+                if (currentPreset != null && currentPreset.IsBuildIn)\r
+                {\r
+                    this.errorService.ShowMessageBox(Resources.Main_NoUpdateOfBuiltInPresets, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);\r
+                    return;\r
+                }\r
+\r
+                MessageBoxResult result = this.errorService.ShowMessageBox(Resources.AddPresetViewModel_PresetWithSameNameOverwriteWarning, Resources.Question, MessageBoxButton.YesNo, MessageBoxImage.Question);\r
                 if (result == MessageBoxResult.No)\r
                 {\r
                     return;\r
@@ -282,8 +289,11 @@ namespace HandBrakeWPF.ViewModels
             bool added = this.presetService.Add(this.Preset);\r
             if (!added)\r
             {\r
-                this.errorService.ShowMessageBox(Resources.AddPresetViewModel_UnableToAddPreset, Resources.UnknownError, MessageBoxButton.OK,\r
-                                                 MessageBoxImage.Error);\r
+                this.errorService.ShowMessageBox(\r
+                    Resources.AddPresetViewModel_UnableToAddPreset,\r
+                    Resources.UnknownError,\r
+                    MessageBoxButton.OK,\r
+                    MessageBoxImage.Error);\r
             }\r
             else\r
             {\r