1515using ModernWpf ;
1616using ThemeManager = Flow . Launcher . Core . Resource . ThemeManager ;
1717using ThemeManagerForColorSchemeSwitch = ModernWpf . ThemeManager ;
18- using static Flow . Launcher . Core . Resource . Theme ;
19- using System . Windows . Interop ;
2018
2119namespace Flow . Launcher . SettingPages . ViewModels ;
2220
@@ -38,8 +36,11 @@ public Theme.ThemeData SelectedTheme
3836 ThemeManager . Instance . ChangeTheme ( value . FileNameWithoutExtension ) ;
3937
4038 if ( ThemeManager . Instance . BlurEnabled && Settings . UseDropShadowEffect == false )
39+ {
4140 DropShadowEffect = true ;
4241 OnPropertyChanged ( nameof ( IsDropShadowEnabled ) ) ;
42+ }
43+
4344 ThemeManager . Instance . RefreshFrame ( ) ;
4445 //ThemeManager.Instance.SetBlurForWindow();
4546 }
@@ -107,6 +108,24 @@ public double ResultSubItemFontSize
107108 public class ColorSchemeData : DropdownDataGeneric < ColorSchemes > { }
108109
109110 public List < ColorSchemeData > ColorSchemes { get ; } = DropdownDataGeneric < ColorSchemes > . GetValues < ColorSchemeData > ( "ColorScheme" ) ;
111+ public string ColorScheme
112+ {
113+ get => Settings . ColorScheme ;
114+ set
115+ {
116+ ThemeManagerForColorSchemeSwitch . Current . ApplicationTheme = value switch
117+ {
118+ Constant . Light => ApplicationTheme . Light ,
119+ Constant . Dark => ApplicationTheme . Dark ,
120+ Constant . System => null ,
121+ _ => ThemeManagerForColorSchemeSwitch . Current . ApplicationTheme
122+ } ;
123+
124+ ThemeManager . Instance . RefreshFrame ( ) ;
125+
126+ Settings . ColorScheme = value ;
127+ }
128+ }
110129
111130 public List < string > TimeFormatList { get ; } = new ( )
112131 {
@@ -209,9 +228,8 @@ public void ApplyBackdrop()
209228 public BackdropTypes BackdropType
210229 {
211230 get => Enum . IsDefined ( typeof ( BackdropTypes ) , Settings . BackdropType )
212- ? ( BackdropTypes ) Settings . BackdropType
231+ ? Settings . BackdropType
213232 : BackdropTypes . None ;
214-
215233 set
216234 {
217235 if ( ! Enum . IsDefined ( typeof ( BackdropTypes ) , value ) )
@@ -230,9 +248,6 @@ public BackdropTypes BackdropType
230248 }
231249 }
232250
233-
234-
235-
236251 public bool UseSound
237252 {
238253 get => Settings . UseSound ;
@@ -457,27 +472,15 @@ public FamilyTypeface SelectedResultSubFontFaces
457472
458473 public string ThemeImage => Constant . QueryTextBoxIconImagePath ;
459474
460- [ RelayCommand ]
461- private void OpenThemesFolder ( )
462- {
463- App . API . OpenDirectory ( Path . Combine ( DataLocation . DataDirectory ( ) , Constant . Themes ) ) ;
464- }
465-
466- public void UpdateColorScheme ( )
475+ public SettingsPaneThemeViewModel ( Settings settings )
467476 {
468- ThemeManagerForColorSchemeSwitch . Current . ApplicationTheme = Settings . ColorScheme switch
469- {
470- Constant . Light => ApplicationTheme . Light ,
471- Constant . Dark => ApplicationTheme . Dark ,
472- Constant . System => null ,
473- _ => ThemeManagerForColorSchemeSwitch . Current . ApplicationTheme
474- } ;
475- ThemeManager . Instance . RefreshFrame ( ) ;
477+ Settings = settings ;
476478 }
477479
478- public SettingsPaneThemeViewModel ( Settings settings )
480+ [ RelayCommand ]
481+ private void OpenThemesFolder ( )
479482 {
480- Settings = settings ;
483+ App . API . OpenDirectory ( Path . Combine ( DataLocation . DataDirectory ( ) , Constant . Themes ) ) ;
481484 }
482485
483486 [ RelayCommand ]
0 commit comments