整理控件库
This commit is contained in:
@@ -12,7 +12,7 @@ using WPFluent.Extensions;
|
||||
|
||||
namespace WPFluent.Gallery.ViewModels.Pages;
|
||||
|
||||
public sealed partial class SettingsViewModel(INavigationService navigationService) : ViewModel
|
||||
public sealed partial class SettingsViewModel() : ViewModel
|
||||
{
|
||||
private bool _isInitialized = false;
|
||||
|
||||
@@ -20,11 +20,7 @@ public sealed partial class SettingsViewModel(INavigationService navigationServi
|
||||
private string _appVersion = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private ApplicationTheme _currentApplicationTheme = ApplicationTheme.Unknown;
|
||||
|
||||
[ObservableProperty]
|
||||
private NavigationViewPaneDisplayMode _currentApplicationNavigationStyle =
|
||||
NavigationViewPaneDisplayMode.Left;
|
||||
private ThemeType _currentApplicationTheme = ThemeType.Unknow;
|
||||
|
||||
public override void OnNavigatedTo()
|
||||
{
|
||||
@@ -34,30 +30,23 @@ public sealed partial class SettingsViewModel(INavigationService navigationServi
|
||||
}
|
||||
}
|
||||
|
||||
partial void OnCurrentApplicationThemeChanged(ApplicationTheme oldValue, ApplicationTheme newValue)
|
||||
partial void OnCurrentApplicationThemeChanged(ThemeType oldValue, ThemeType newValue)
|
||||
{
|
||||
ApplicationThemeManager.Apply(newValue);
|
||||
ThemeManager.ChangeAppTheme(newValue);
|
||||
}
|
||||
|
||||
partial void OnCurrentApplicationNavigationStyleChanged(
|
||||
NavigationViewPaneDisplayMode oldValue,
|
||||
NavigationViewPaneDisplayMode newValue
|
||||
)
|
||||
{
|
||||
_ = navigationService.SetPaneDisplayMode(newValue);
|
||||
}
|
||||
|
||||
private void InitializeViewModel()
|
||||
{
|
||||
CurrentApplicationTheme = ApplicationThemeManager.GetAppTheme();
|
||||
CurrentApplicationTheme = ThemeManager.GetAppTheme();
|
||||
AppVersion = $"{GetAssemblyVersion()}";
|
||||
|
||||
ApplicationThemeManager.Changed += OnThemeChanged;
|
||||
ThemeManager.Changed += OnThemeChanged;
|
||||
|
||||
_isInitialized = true;
|
||||
}
|
||||
|
||||
private void OnThemeChanged(ApplicationTheme currentApplicationTheme, Color systemAccent)
|
||||
private void OnThemeChanged(ThemeType currentApplicationTheme, Color systemAccent)
|
||||
{
|
||||
// Update the theme if it has been changed elsewhere than in the settings.
|
||||
if (CurrentApplicationTheme != currentApplicationTheme)
|
||||
|
||||
Reference in New Issue
Block a user