Skip to content

Commit 8484c2b

Browse files
committed
Fix color scheme change issue & Code cleanup
1 parent caa5a48 commit 8484c2b

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,15 @@ public ColorSchemes ColorScheme
113113
get => Settings.ColorScheme;
114114
set
115115
{
116-
UpdateColorScheme();
116+
ThemeManagerForColorSchemeSwitch.Current.ApplicationTheme = value switch
117+
{
118+
Infrastructure.UserSettings.ColorSchemes.Light => ApplicationTheme.Light,
119+
Infrastructure.UserSettings.ColorSchemes.Dark => ApplicationTheme.Dark,
120+
Infrastructure.UserSettings.ColorSchemes.System => null,
121+
_ => ThemeManagerForColorSchemeSwitch.Current.ApplicationTheme
122+
};
123+
124+
ThemeManager.Instance.RefreshFrame();
117125

118126
Settings.ColorScheme = value;
119127
}
@@ -220,9 +228,8 @@ public void ApplyBackdrop()
220228
public BackdropTypes BackdropType
221229
{
222230
get => Enum.IsDefined(typeof(BackdropTypes), Settings.BackdropType)
223-
? (BackdropTypes)Settings.BackdropType
231+
? Settings.BackdropType
224232
: BackdropTypes.None;
225-
226233
set
227234
{
228235
if (!Enum.IsDefined(typeof(BackdropTypes), value))
@@ -241,9 +248,6 @@ public BackdropTypes BackdropType
241248
}
242249
}
243250

244-
245-
246-
247251
public bool UseSound
248252
{
249253
get => Settings.UseSound;
@@ -468,27 +472,15 @@ public FamilyTypeface SelectedResultSubFontFaces
468472

469473
public string ThemeImage => Constant.QueryTextBoxIconImagePath;
470474

471-
[RelayCommand]
472-
private void OpenThemesFolder()
473-
{
474-
App.API.OpenDirectory(Path.Combine(DataLocation.DataDirectory(), Constant.Themes));
475-
}
476-
477-
private void UpdateColorScheme()
475+
public SettingsPaneThemeViewModel(Settings settings)
478476
{
479-
ThemeManagerForColorSchemeSwitch.Current.ApplicationTheme = Settings.ColorScheme switch
480-
{
481-
Infrastructure.UserSettings.ColorSchemes.Light => ApplicationTheme.Light,
482-
Infrastructure.UserSettings.ColorSchemes.Dark => ApplicationTheme.Dark,
483-
Infrastructure.UserSettings.ColorSchemes.System => null,
484-
_ => ThemeManagerForColorSchemeSwitch.Current.ApplicationTheme
485-
};
486-
ThemeManager.Instance.RefreshFrame();
477+
Settings = settings;
487478
}
488479

489-
public SettingsPaneThemeViewModel(Settings settings)
480+
[RelayCommand]
481+
private void OpenThemesFolder()
490482
{
491-
Settings = settings;
483+
App.API.OpenDirectory(Path.Combine(DataLocation.DataDirectory(), Constant.Themes));
492484
}
493485

494486
[RelayCommand]

0 commit comments

Comments
 (0)