]> granicus.if.org Git - handbrake/commitdiff
WinGui: Correctly synchronise the WhenDone dropdowns in the Queue, MainWindow and...
authorsr55 <sr55.hb@outlook.com>
Sun, 8 Jan 2017 10:43:47 +0000 (10:43 +0000)
committersr55 <sr55.hb@outlook.com>
Sun, 8 Jan 2017 10:44:00 +0000 (10:44 +0000)
win/CS/HandBrakeWPF/ViewModels/Interfaces/IOptionsViewModel.cs
win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs
win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
win/CS/HandBrakeWPF/Views/MainView.xaml
win/CS/HandBrakeWPF/Views/QueueView.xaml

index c2d48f8e51f231368c11d852d36d574faeea93f6..e37f1da078b24035546a75ee8e8d793a09f905a7 100644 (file)
@@ -23,5 +23,10 @@ namespace HandBrakeWPF.ViewModels.Interfaces
         /// The tab.\r
         /// </param>\r
         void GotoTab(OptionsTab tab);\r
+\r
+        /// <summary>\r
+        /// Refresh certain UI controls that can be updated outside preferences.\r
+        /// </summary>\r
+        void UpdateSettings();\r
     }\r
 }
\ No newline at end of file
index 51c8e462efb03f7d22bb4bee7978a6ab1b28e0f6..4f455d37356f56ba308cc2f32266e0f87d101be3 100644 (file)
@@ -20,7 +20,10 @@ namespace HandBrakeWPF.ViewModels.Interfaces
         /// <param name="action">\r
         /// The action.\r
         /// </param>\r
-        void WhenDone(string action);\r
+        /// <param name="saveChange">\r
+        /// Save the change to the setting. Use false when updating UI.\r
+        /// </param>\r
+        void WhenDone(string action, bool saveChange);\r
 \r
         /// <summary>\r
         /// The import.\r
index 15b95986790379709bd48cb1591c75c7576190a9..39db1a5608b839d31e77216cc1c1316ea6be1b9b 100644 (file)
@@ -1713,7 +1713,7 @@ namespace HandBrakeWPF.ViewModels
         /// <param name="action">action</param>\r
         public void WhenDone(string action)\r
         {\r
-            this.QueueViewModel?.WhenDone(action);\r
+            this.QueueViewModel?.WhenDone(action, true);\r
         }\r
 \r
         #endregion\r
@@ -2517,10 +2517,17 @@ namespace HandBrakeWPF.ViewModels
         /// </param>\r
         private void UserSettingServiceSettingChanged(object sender, SettingChangedEventArgs e)\r
         {\r
-            if (e.Key == UserSettingConstants.ShowAdvancedTab)\r
+            switch (e.Key)\r
             {\r
-                this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);\r
+                case UserSettingConstants.ShowAdvancedTab:\r
+                    this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);\r
+                    break;\r
+\r
+                case UserSettingConstants.WhenCompleteAction:\r
+                    this.QueueViewModel.WhenDone(this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction), false);\r
+                    break;\r
             }\r
+\r
         }\r
 \r
         /// <summary>\r
index cdf480be6e3c55be49eeefdf5081fc926a87405e..873e2b513a656cee1ca5ef26d36700a608ae8ef3 100644 (file)
@@ -15,7 +15,6 @@ namespace HandBrakeWPF.ViewModels
     using System.Globalization;\r
     using System.IO;\r
     using System.Linq;\r
-    using System.Text;\r
     using System.Windows;\r
 \r
     using Caliburn.Micro;\r
@@ -1317,6 +1316,15 @@ namespace HandBrakeWPF.ViewModels
 \r
             // Use dvdnav\r
             this.DisableLibdvdNav = userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav);\r
+\r
+        }\r
+\r
+        /// <summary>\r
+        /// Some settings can be changed outside of this window. This will refresh their UI controls.\r
+        /// </summary>\r
+        public void UpdateSettings()\r
+        {\r
+            this.WhenDone = userSettingService.GetUserSetting<string>("WhenCompleteAction");\r
         }\r
 \r
         /// <summary>\r
index f56e6f4fc6692ae96831680e67c429fedc8dc4db..97811dec9ab9bc89b5d5e29ad9a0f671d605a651 100644 (file)
@@ -177,9 +177,30 @@ namespace HandBrakeWPF.ViewModels
         /// The action.\r
         /// </param>\r
         public void WhenDone(string action)\r
+        {\r
+            this.WhenDone(action, true);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Update the When Done Setting\r
+        /// </summary>\r
+        /// <param name="action">\r
+        /// The action.\r
+        /// </param>\r
+        /// <param name="saveChange">\r
+        /// Save the change to the setting. Use false when updating UI.\r
+        /// </param>\r
+        public void WhenDone(string action, bool saveChange)\r
         {\r
             this.WhenDoneAction = action;\r
-            this.userSettingService.SetUserSetting(UserSettingConstants.WhenCompleteAction, action);\r
+\r
+            if (saveChange)\r
+            {\r
+                this.userSettingService.SetUserSetting(UserSettingConstants.WhenCompleteAction, action);\r
+            }\r
+\r
+            IOptionsViewModel ovm = IoC.Get<IOptionsViewModel>();\r
+            ovm.UpdateSettings();\r
         }\r
 \r
         /// <summary>\r
index e257a4ea8f920c0e904c0d7bc1417a018e39f04d..e0e1156fd361c2275d5f42a6b39680ea2c6382ba 100644 (file)
 \r
                         <MenuItem x:Name="doNothing"\r
                                   cal:Message.Attach="[Event Click] = [Action WhenDone(doNothing.Header)]"\r
-                                  Header="{x:Static Properties:ResourcesUI.QueueView_DoNothing}"\r
-                                  IsCheckable="True"\r
-                                  attachedProperties:MenuItemExtensions.GroupName="whenDone" />\r
-                        <MenuItem x:Name="shutdown"\r
-                                  cal:Message.Attach="[Event Click] = [Action WhenDone(shutdown.Header)]"\r
-                                  Header="{x:Static Properties:ResourcesUI.QueueView_Shutdown}"\r
-                                  IsCheckable="True"\r
-                                  attachedProperties:MenuItemExtensions.GroupName="whenDone" />\r
+                                  Header="{x:Static Properties:ResourcesUI.QueueView_DoNothing}" />\r
+                        <MenuItem x:Name="shutdownSystem"\r
+                                  cal:Message.Attach="[Event Click] = [Action WhenDone(shutdownSystem.Header)]"\r
+                                  Header="{x:Static Properties:ResourcesUI.QueueView_Shutdown}" />\r
                         <MenuItem x:Name="suspend"\r
                                   cal:Message.Attach="[Event Click] = [Action WhenDone(suspend.Header)]"\r
-                                  Header="{x:Static Properties:ResourcesUI.QueueView_Suspend}"\r
-                                  IsCheckable="True"\r
-                                  attachedProperties:MenuItemExtensions.GroupName="whenDone" />\r
+                                  Header="{x:Static Properties:ResourcesUI.QueueView_Suspend}"/>\r
                         <MenuItem x:Name="hibernate"\r
                                   cal:Message.Attach="[Event Click] = [Action WhenDone(hibernate.Header)]"\r
-                                  Header="{x:Static Properties:ResourcesUI.QueueView_Hibernate}"\r
-                                  IsCheckable="True"\r
-                                  attachedProperties:MenuItemExtensions.GroupName="whenDone" />\r
+                                  Header="{x:Static Properties:ResourcesUI.QueueView_Hibernate}" />\r
                         <MenuItem x:Name="lock"\r
                                   cal:Message.Attach="[Event Click] = [Action WhenDone(lock.Header)]"\r
-                                  Header="{x:Static Properties:ResourcesUI.QueueView_LockSystem}"\r
-                                  IsCheckable="True"\r
-                                  attachedProperties:MenuItemExtensions.GroupName="whenDone" />\r
+                                  Header="{x:Static Properties:ResourcesUI.QueueView_LockSystem}" />\r
                         <MenuItem x:Name="logoff"\r
                                   cal:Message.Attach="[Event Click] = [Action WhenDone(logoff.Header)]"\r
-                                  Header="{x:Static Properties:ResourcesUI.QueueView_Logoff}"\r
-                                  IsCheckable="True"\r
-                                  attachedProperties:MenuItemExtensions.GroupName="whenDone" />\r
+                                  Header="{x:Static Properties:ResourcesUI.QueueView_Logoff}"/>\r
                         <MenuItem x:Name="quit"\r
                                   cal:Message.Attach="[Event Click] = [Action WhenDone(quit.Header)]"\r
-                                  Header="{x:Static Properties:ResourcesUI.QueueView_QuitHandBrake}"\r
-                                  IsCheckable="True"\r
-                                  attachedProperties:MenuItemExtensions.GroupName="whenDone" />\r
+                                  Header="{x:Static Properties:ResourcesUI.QueueView_QuitHandBrake}" />\r
                     </MenuItem>\r
                 </Menu>\r
             </StatusBarItem>\r
index 414c29e30611bd2ca57c8f1c63286fdee33d5347..127a2513300c21402649da0a6877bcc4b2b38694 100644 (file)
 \r
                             <MenuItem x:Name="doNothing"\r
                                   cal:Message.Attach="[Event Click] = [Action WhenDone(doNothing.Header)]"\r
-                                  Header="{x:Static Properties:ResourcesUI.QueueView_DoNothing}"\r
-                                  IsCheckable="True"\r
-                                  AttachedProperties:MenuItemExtensions.GroupName="whenDone" />\r
+                                  Header="{x:Static Properties:ResourcesUI.QueueView_DoNothing}" />\r
                             <MenuItem x:Name="shutdown"\r
                                   cal:Message.Attach="[Event Click] = [Action WhenDone(shutdown.Header)]"\r
-                                  Header="{x:Static Properties:ResourcesUI.QueueView_Shutdown}"\r
-                                  IsCheckable="True"\r
-                                  AttachedProperties:MenuItemExtensions.GroupName="whenDone" />\r
+                                  Header="{x:Static Properties:ResourcesUI.QueueView_Shutdown}" />\r
                             <MenuItem x:Name="suspend"\r
                                   cal:Message.Attach="[Event Click] = [Action WhenDone(suspend.Header)]"\r
-                                  Header="{x:Static Properties:ResourcesUI.QueueView_Suspend}"\r
-                                  IsCheckable="True"\r
-                                  AttachedProperties:MenuItemExtensions.GroupName="whenDone" />\r
+                                  Header="{x:Static Properties:ResourcesUI.QueueView_Suspend}" />\r
                             <MenuItem x:Name="hibernate"\r
                                   cal:Message.Attach="[Event Click] = [Action WhenDone(hibernate.Header)]"\r
-                                  Header="{x:Static Properties:ResourcesUI.QueueView_Hibernate}"\r
-                                  IsCheckable="True"\r
-                                  AttachedProperties:MenuItemExtensions.GroupName="whenDone" />\r
+                                  Header="{x:Static Properties:ResourcesUI.QueueView_Hibernate}"/>\r
                             <MenuItem x:Name="lock"\r
                                   cal:Message.Attach="[Event Click] = [Action WhenDone(lock.Header)]"\r
-                                  Header="{x:Static Properties:ResourcesUI.QueueView_LockSystem}"\r
-                                  IsCheckable="True"\r
-                                  AttachedProperties:MenuItemExtensions.GroupName="whenDone" />\r
+                                  Header="{x:Static Properties:ResourcesUI.QueueView_LockSystem}" />\r
                             <MenuItem x:Name="logoff"\r
                                   cal:Message.Attach="[Event Click] = [Action WhenDone(logoff.Header)]"\r
-                                  Header="{x:Static Properties:ResourcesUI.QueueView_Logoff}"\r
-                                  IsCheckable="True"\r
-                                  AttachedProperties:MenuItemExtensions.GroupName="whenDone" />\r
+                                  Header="{x:Static Properties:ResourcesUI.QueueView_Logoff}"/>\r
                             <MenuItem x:Name="quit"\r
                                   cal:Message.Attach="[Event Click] = [Action WhenDone(quit.Header)]"\r
-                                  Header="{x:Static Properties:ResourcesUI.QueueView_QuitHandBrake}"\r
-                                  IsCheckable="True"\r
-                                  AttachedProperties:MenuItemExtensions.GroupName="whenDone" />\r
+                                  Header="{x:Static Properties:ResourcesUI.QueueView_QuitHandBrake}"/>\r
                         </MenuItem>\r
                     </Menu>\r
 \r