diff options
author | sr55 <[email protected]> | 2017-01-08 10:43:47 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2017-01-08 10:43:47 +0000 |
commit | 3e3218dfb1e09f7f2aa851d03c0dfedbf1b53a68 (patch) | |
tree | 1e7491cd47c2d6836c5cc07e5248439ba59ce9b2 | |
parent | 0c34c5f8a2a368b894f3f671c582557ea45dc62d (diff) |
WinGui: Correctly synchronise the WhenDone dropdowns in the Queue, MainWindow and Preferences
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/Interfaces/IOptionsViewModel.cs | 5 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs | 5 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 13 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 10 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs | 23 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml | 32 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/QueueView.xaml | 28 |
7 files changed, 66 insertions, 50 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IOptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IOptionsViewModel.cs index c2d48f8e5..e37f1da07 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IOptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IOptionsViewModel.cs @@ -23,5 +23,10 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// The tab.
/// </param>
void GotoTab(OptionsTab tab);
+
+ /// <summary>
+ /// Refresh certain UI controls that can be updated outside preferences.
+ /// </summary>
+ void UpdateSettings();
}
}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs index 51c8e462e..4f455d373 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs @@ -20,7 +20,10 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// <param name="action">
/// The action.
/// </param>
- void WhenDone(string action);
+ /// <param name="saveChange">
+ /// Save the change to the setting. Use false when updating UI.
+ /// </param>
+ void WhenDone(string action, bool saveChange);
/// <summary>
/// The import.
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 15b959867..39db1a560 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1713,7 +1713,7 @@ namespace HandBrakeWPF.ViewModels /// <param name="action">action</param>
public void WhenDone(string action)
{
- this.QueueViewModel?.WhenDone(action);
+ this.QueueViewModel?.WhenDone(action, true);
}
#endregion
@@ -2517,10 +2517,17 @@ namespace HandBrakeWPF.ViewModels /// </param>
private void UserSettingServiceSettingChanged(object sender, SettingChangedEventArgs e)
{
- if (e.Key == UserSettingConstants.ShowAdvancedTab)
+ switch (e.Key)
{
- this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);
+ case UserSettingConstants.ShowAdvancedTab:
+ this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);
+ break;
+
+ case UserSettingConstants.WhenCompleteAction:
+ this.QueueViewModel.WhenDone(this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction), false);
+ break;
}
+
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index cdf480be6..873e2b513 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -15,7 +15,6 @@ namespace HandBrakeWPF.ViewModels using System.Globalization;
using System.IO;
using System.Linq;
- using System.Text;
using System.Windows;
using Caliburn.Micro;
@@ -1317,6 +1316,15 @@ namespace HandBrakeWPF.ViewModels // Use dvdnav
this.DisableLibdvdNav = userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav);
+
+ }
+
+ /// <summary>
+ /// Some settings can be changed outside of this window. This will refresh their UI controls.
+ /// </summary>
+ public void UpdateSettings()
+ {
+ this.WhenDone = userSettingService.GetUserSetting<string>("WhenCompleteAction");
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index f56e6f4fc..97811dec9 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -178,8 +178,29 @@ namespace HandBrakeWPF.ViewModels /// </param>
public void WhenDone(string action)
{
+ this.WhenDone(action, true);
+ }
+
+ /// <summary>
+ /// Update the When Done Setting
+ /// </summary>
+ /// <param name="action">
+ /// The action.
+ /// </param>
+ /// <param name="saveChange">
+ /// Save the change to the setting. Use false when updating UI.
+ /// </param>
+ public void WhenDone(string action, bool saveChange)
+ {
this.WhenDoneAction = action;
- this.userSettingService.SetUserSetting(UserSettingConstants.WhenCompleteAction, action);
+
+ if (saveChange)
+ {
+ this.userSettingService.SetUserSetting(UserSettingConstants.WhenCompleteAction, action);
+ }
+
+ IOptionsViewModel ovm = IoC.Get<IOptionsViewModel>();
+ ovm.UpdateSettings();
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index e257a4ea8..e0e1156fd 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -737,39 +737,25 @@ <MenuItem x:Name="doNothing"
cal:Message.Attach="[Event Click] = [Action WhenDone(doNothing.Header)]"
- Header="{x:Static Properties:ResourcesUI.QueueView_DoNothing}"
- IsCheckable="True"
- attachedProperties:MenuItemExtensions.GroupName="whenDone" />
- <MenuItem x:Name="shutdown"
- cal:Message.Attach="[Event Click] = [Action WhenDone(shutdown.Header)]"
- Header="{x:Static Properties:ResourcesUI.QueueView_Shutdown}"
- IsCheckable="True"
- attachedProperties:MenuItemExtensions.GroupName="whenDone" />
+ Header="{x:Static Properties:ResourcesUI.QueueView_DoNothing}" />
+ <MenuItem x:Name="shutdownSystem"
+ cal:Message.Attach="[Event Click] = [Action WhenDone(shutdownSystem.Header)]"
+ Header="{x:Static Properties:ResourcesUI.QueueView_Shutdown}" />
<MenuItem x:Name="suspend"
cal:Message.Attach="[Event Click] = [Action WhenDone(suspend.Header)]"
- Header="{x:Static Properties:ResourcesUI.QueueView_Suspend}"
- IsCheckable="True"
- attachedProperties:MenuItemExtensions.GroupName="whenDone" />
+ Header="{x:Static Properties:ResourcesUI.QueueView_Suspend}"/>
<MenuItem x:Name="hibernate"
cal:Message.Attach="[Event Click] = [Action WhenDone(hibernate.Header)]"
- Header="{x:Static Properties:ResourcesUI.QueueView_Hibernate}"
- IsCheckable="True"
- attachedProperties:MenuItemExtensions.GroupName="whenDone" />
+ Header="{x:Static Properties:ResourcesUI.QueueView_Hibernate}" />
<MenuItem x:Name="lock"
cal:Message.Attach="[Event Click] = [Action WhenDone(lock.Header)]"
- Header="{x:Static Properties:ResourcesUI.QueueView_LockSystem}"
- IsCheckable="True"
- attachedProperties:MenuItemExtensions.GroupName="whenDone" />
+ Header="{x:Static Properties:ResourcesUI.QueueView_LockSystem}" />
<MenuItem x:Name="logoff"
cal:Message.Attach="[Event Click] = [Action WhenDone(logoff.Header)]"
- Header="{x:Static Properties:ResourcesUI.QueueView_Logoff}"
- IsCheckable="True"
- attachedProperties:MenuItemExtensions.GroupName="whenDone" />
+ Header="{x:Static Properties:ResourcesUI.QueueView_Logoff}"/>
<MenuItem x:Name="quit"
cal:Message.Attach="[Event Click] = [Action WhenDone(quit.Header)]"
- Header="{x:Static Properties:ResourcesUI.QueueView_QuitHandBrake}"
- IsCheckable="True"
- attachedProperties:MenuItemExtensions.GroupName="whenDone" />
+ Header="{x:Static Properties:ResourcesUI.QueueView_QuitHandBrake}" />
</MenuItem>
</Menu>
</StatusBarItem>
diff --git a/win/CS/HandBrakeWPF/Views/QueueView.xaml b/win/CS/HandBrakeWPF/Views/QueueView.xaml index 414c29e30..127a25133 100644 --- a/win/CS/HandBrakeWPF/Views/QueueView.xaml +++ b/win/CS/HandBrakeWPF/Views/QueueView.xaml @@ -115,39 +115,25 @@ <MenuItem x:Name="doNothing"
cal:Message.Attach="[Event Click] = [Action WhenDone(doNothing.Header)]"
- Header="{x:Static Properties:ResourcesUI.QueueView_DoNothing}"
- IsCheckable="True"
- AttachedProperties:MenuItemExtensions.GroupName="whenDone" />
+ Header="{x:Static Properties:ResourcesUI.QueueView_DoNothing}" />
<MenuItem x:Name="shutdown"
cal:Message.Attach="[Event Click] = [Action WhenDone(shutdown.Header)]"
- Header="{x:Static Properties:ResourcesUI.QueueView_Shutdown}"
- IsCheckable="True"
- AttachedProperties:MenuItemExtensions.GroupName="whenDone" />
+ Header="{x:Static Properties:ResourcesUI.QueueView_Shutdown}" />
<MenuItem x:Name="suspend"
cal:Message.Attach="[Event Click] = [Action WhenDone(suspend.Header)]"
- Header="{x:Static Properties:ResourcesUI.QueueView_Suspend}"
- IsCheckable="True"
- AttachedProperties:MenuItemExtensions.GroupName="whenDone" />
+ Header="{x:Static Properties:ResourcesUI.QueueView_Suspend}" />
<MenuItem x:Name="hibernate"
cal:Message.Attach="[Event Click] = [Action WhenDone(hibernate.Header)]"
- Header="{x:Static Properties:ResourcesUI.QueueView_Hibernate}"
- IsCheckable="True"
- AttachedProperties:MenuItemExtensions.GroupName="whenDone" />
+ Header="{x:Static Properties:ResourcesUI.QueueView_Hibernate}"/>
<MenuItem x:Name="lock"
cal:Message.Attach="[Event Click] = [Action WhenDone(lock.Header)]"
- Header="{x:Static Properties:ResourcesUI.QueueView_LockSystem}"
- IsCheckable="True"
- AttachedProperties:MenuItemExtensions.GroupName="whenDone" />
+ Header="{x:Static Properties:ResourcesUI.QueueView_LockSystem}" />
<MenuItem x:Name="logoff"
cal:Message.Attach="[Event Click] = [Action WhenDone(logoff.Header)]"
- Header="{x:Static Properties:ResourcesUI.QueueView_Logoff}"
- IsCheckable="True"
- AttachedProperties:MenuItemExtensions.GroupName="whenDone" />
+ Header="{x:Static Properties:ResourcesUI.QueueView_Logoff}"/>
<MenuItem x:Name="quit"
cal:Message.Attach="[Event Click] = [Action WhenDone(quit.Header)]"
- Header="{x:Static Properties:ResourcesUI.QueueView_QuitHandBrake}"
- IsCheckable="True"
- AttachedProperties:MenuItemExtensions.GroupName="whenDone" />
+ Header="{x:Static Properties:ResourcesUI.QueueView_QuitHandBrake}"/>
</MenuItem>
</Menu>
|