Skip to content

Commit

Permalink
Fix "Use system setting" theme not saving properly
Browse files Browse the repository at this point in the history
  • Loading branch information
sabihoshi committed Sep 22, 2022
1 parent 90fac19 commit 53c9fa7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
8 changes: 4 additions & 4 deletions GenshinLyreMidiPlayer.WPF/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ public void ToggleTheme()
{
ThemeManager.Current.ApplicationTheme = _theme.GetTheme() switch
{
ThemeType.Unknown => ApplicationTheme.Dark,
ThemeType.Dark => ApplicationTheme.Light,
ThemeType.Light => ApplicationTheme.Dark,
ThemeType.Unknown => ApplicationTheme.Dark,
ThemeType.Dark => ApplicationTheme.Light,
ThemeType.Light => ApplicationTheme.Dark,
ThemeType.HighContrast => ApplicationTheme.Dark,
_ => ApplicationTheme.Dark
_ => ApplicationTheme.Dark
};

SettingsView.OnThemeChanged();
Expand Down
11 changes: 1 addition & 10 deletions GenshinLyreMidiPlayer.WPF/ViewModels/SettingsPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,20 +319,11 @@ await Task.Delay(start, PlayTimerToken.Token)
[UsedImplicitly]
public void OnThemeChanged()
{
ThemeManager.Current.ApplicationTheme ??= _theme.GetSystemTheme() switch
{
ThemeType.Unknown => ApplicationTheme.Light,
ThemeType.Dark => ApplicationTheme.Dark,
ThemeType.Light => ApplicationTheme.Light,
ThemeType.HighContrast => ApplicationTheme.Dark,
_ => ApplicationTheme.Light
};

_theme.SetTheme(ThemeManager.Current.ApplicationTheme switch
{
ApplicationTheme.Light => ThemeType.Light,
ApplicationTheme.Dark => ThemeType.Dark,
_ => ThemeType.Light
_ => _theme.GetSystemTheme()
});

Settings.Modify(s => s.AppTheme = (int?) ThemeManager.Current.ApplicationTheme ?? -1);
Expand Down

0 comments on commit 53c9fa7

Please sign in to comment.