@@ -25,9 +25,9 @@ public class Theme
2525
2626 private const int ShadowExtraMargin = 32 ;
2727
28- private readonly IPublicAPI API ;
29- private readonly Settings Settings ;
30- private readonly List < string > _themeDirectories = new List < string > ( ) ;
28+ private readonly IPublicAPI _api ;
29+ private readonly Settings _settings ;
30+ private readonly List < string > _themeDirectories = new ( ) ;
3131 private ResourceDictionary _oldResource ;
3232 private string _oldTheme ;
3333 private const string Folder = Constant . Themes ;
@@ -41,8 +41,8 @@ public class Theme
4141
4242 public Theme ( IPublicAPI publicAPI , Settings settings )
4343 {
44- API = publicAPI ;
45- Settings = settings ;
44+ _api = publicAPI ;
45+ _settings = settings ;
4646
4747 _themeDirectories . Add ( DirectoryPath ) ;
4848 _themeDirectories . Add ( UserDirectoryPath ) ;
@@ -94,7 +94,7 @@ public bool ChangeTheme(string theme)
9494 // to things like fonts
9595 UpdateResourceDictionary ( GetResourceDictionary ( theme ) ) ;
9696
97- Settings . Theme = theme ;
97+ _settings . Theme = theme ;
9898
9999
100100 //always allow re-loading default theme, in case of failure of switching to a new theme from default theme
@@ -105,7 +105,7 @@ public bool ChangeTheme(string theme)
105105
106106 BlurEnabled = Win32Helper . IsBlurTheme ( ) ;
107107
108- if ( Settings . UseDropShadowEffect && ! BlurEnabled )
108+ if ( _settings . UseDropShadowEffect && ! BlurEnabled )
109109 AddDropShadowEffectToCurrentTheme ( ) ;
110110
111111 Win32Helper . SetBlurForWindow ( Application . Current . MainWindow , BlurEnabled ) ;
@@ -115,7 +115,7 @@ public bool ChangeTheme(string theme)
115115 Log . Error ( $ "|Theme.ChangeTheme|Theme <{ theme } > path can't be found") ;
116116 if ( theme != defaultTheme )
117117 {
118- API . ShowMsgBox ( string . Format ( InternationalizationManager . Instance . GetTranslation ( "theme_load_failure_path_not_exists" ) , theme ) ) ;
118+ _api . ShowMsgBox ( string . Format ( InternationalizationManager . Instance . GetTranslation ( "theme_load_failure_path_not_exists" ) , theme ) ) ;
119119 ChangeTheme ( defaultTheme ) ;
120120 }
121121 return false ;
@@ -125,7 +125,7 @@ public bool ChangeTheme(string theme)
125125 Log . Error ( $ "|Theme.ChangeTheme|Theme <{ theme } > fail to parse") ;
126126 if ( theme != defaultTheme )
127127 {
128- API . ShowMsgBox ( string . Format ( InternationalizationManager . Instance . GetTranslation ( "theme_load_failure_parse_error" ) , theme ) ) ;
128+ _api . ShowMsgBox ( string . Format ( InternationalizationManager . Instance . GetTranslation ( "theme_load_failure_parse_error" ) , theme ) ) ;
129129 ChangeTheme ( defaultTheme ) ;
130130 }
131131 return false ;
@@ -153,7 +153,7 @@ private ResourceDictionary GetThemeResourceDictionary(string theme)
153153 return dict ;
154154 }
155155
156- private ResourceDictionary CurrentThemeResourceDictionary ( ) => GetThemeResourceDictionary ( Settings . Theme ) ;
156+ private ResourceDictionary CurrentThemeResourceDictionary ( ) => GetThemeResourceDictionary ( _settings . Theme ) ;
157157
158158 public ResourceDictionary GetResourceDictionary ( string theme )
159159 {
@@ -162,10 +162,10 @@ public ResourceDictionary GetResourceDictionary(string theme)
162162 if ( dict [ "QueryBoxStyle" ] is Style queryBoxStyle &&
163163 dict [ "QuerySuggestionBoxStyle" ] is Style querySuggestionBoxStyle )
164164 {
165- var fontFamily = new FontFamily ( Settings . QueryBoxFont ) ;
166- var fontStyle = FontHelper . GetFontStyleFromInvariantStringOrNormal ( Settings . QueryBoxFontStyle ) ;
167- var fontWeight = FontHelper . GetFontWeightFromInvariantStringOrNormal ( Settings . QueryBoxFontWeight ) ;
168- var fontStretch = FontHelper . GetFontStretchFromInvariantStringOrNormal ( Settings . QueryBoxFontStretch ) ;
165+ var fontFamily = new FontFamily ( _settings . QueryBoxFont ) ;
166+ var fontStyle = FontHelper . GetFontStyleFromInvariantStringOrNormal ( _settings . QueryBoxFontStyle ) ;
167+ var fontWeight = FontHelper . GetFontWeightFromInvariantStringOrNormal ( _settings . QueryBoxFontWeight ) ;
168+ var fontStretch = FontHelper . GetFontStretchFromInvariantStringOrNormal ( _settings . QueryBoxFontStretch ) ;
169169
170170 queryBoxStyle . Setters . Add ( new Setter ( TextBox . FontFamilyProperty , fontFamily ) ) ;
171171 queryBoxStyle . Setters . Add ( new Setter ( TextBox . FontStyleProperty , fontStyle ) ) ;
@@ -190,10 +190,10 @@ public ResourceDictionary GetResourceDictionary(string theme)
190190 dict [ "ItemHotkeyStyle" ] is Style resultHotkeyItemStyle &&
191191 dict [ "ItemHotkeySelectedStyle" ] is Style resultHotkeyItemSelectedStyle )
192192 {
193- Setter fontFamily = new Setter ( TextBlock . FontFamilyProperty , new FontFamily ( Settings . ResultFont ) ) ;
194- Setter fontStyle = new Setter ( TextBlock . FontStyleProperty , FontHelper . GetFontStyleFromInvariantStringOrNormal ( Settings . ResultFontStyle ) ) ;
195- Setter fontWeight = new Setter ( TextBlock . FontWeightProperty , FontHelper . GetFontWeightFromInvariantStringOrNormal ( Settings . ResultFontWeight ) ) ;
196- Setter fontStretch = new Setter ( TextBlock . FontStretchProperty , FontHelper . GetFontStretchFromInvariantStringOrNormal ( Settings . ResultFontStretch ) ) ;
193+ Setter fontFamily = new Setter ( TextBlock . FontFamilyProperty , new FontFamily ( _settings . ResultFont ) ) ;
194+ Setter fontStyle = new Setter ( TextBlock . FontStyleProperty , FontHelper . GetFontStyleFromInvariantStringOrNormal ( _settings . ResultFontStyle ) ) ;
195+ Setter fontWeight = new Setter ( TextBlock . FontWeightProperty , FontHelper . GetFontWeightFromInvariantStringOrNormal ( _settings . ResultFontWeight ) ) ;
196+ Setter fontStretch = new Setter ( TextBlock . FontStretchProperty , FontHelper . GetFontStretchFromInvariantStringOrNormal ( _settings . ResultFontStretch ) ) ;
197197
198198 Setter [ ] setters = { fontFamily , fontStyle , fontWeight , fontStretch } ;
199199 Array . ForEach (
@@ -205,10 +205,10 @@ public ResourceDictionary GetResourceDictionary(string theme)
205205 dict [ "ItemSubTitleStyle" ] is Style resultSubItemStyle &&
206206 dict [ "ItemSubTitleSelectedStyle" ] is Style resultSubItemSelectedStyle )
207207 {
208- Setter fontFamily = new Setter ( TextBlock . FontFamilyProperty , new FontFamily ( Settings . ResultSubFont ) ) ;
209- Setter fontStyle = new Setter ( TextBlock . FontStyleProperty , FontHelper . GetFontStyleFromInvariantStringOrNormal ( Settings . ResultSubFontStyle ) ) ;
210- Setter fontWeight = new Setter ( TextBlock . FontWeightProperty , FontHelper . GetFontWeightFromInvariantStringOrNormal ( Settings . ResultSubFontWeight ) ) ;
211- Setter fontStretch = new Setter ( TextBlock . FontStretchProperty , FontHelper . GetFontStretchFromInvariantStringOrNormal ( Settings . ResultSubFontStretch ) ) ;
208+ Setter fontFamily = new Setter ( TextBlock . FontFamilyProperty , new FontFamily ( _settings . ResultSubFont ) ) ;
209+ Setter fontStyle = new Setter ( TextBlock . FontStyleProperty , FontHelper . GetFontStyleFromInvariantStringOrNormal ( _settings . ResultSubFontStyle ) ) ;
210+ Setter fontWeight = new Setter ( TextBlock . FontWeightProperty , FontHelper . GetFontWeightFromInvariantStringOrNormal ( _settings . ResultSubFontWeight ) ) ;
211+ Setter fontStretch = new Setter ( TextBlock . FontStretchProperty , FontHelper . GetFontStretchFromInvariantStringOrNormal ( _settings . ResultSubFontStretch ) ) ;
212212
213213 Setter [ ] setters = { fontFamily , fontStyle , fontWeight , fontStretch } ;
214214 Array . ForEach (
@@ -218,15 +218,15 @@ public ResourceDictionary GetResourceDictionary(string theme)
218218
219219 /* Ignore Theme Window Width and use setting */
220220 var windowStyle = dict [ "WindowStyle" ] as Style ;
221- var width = Settings . WindowSize ;
221+ var width = _settings . WindowSize ;
222222 windowStyle . Setters . Add ( new Setter ( Window . WidthProperty , width ) ) ;
223223 mainWindowWidth = ( double ) width ;
224224 return dict ;
225225 }
226226
227227 private ResourceDictionary GetCurrentResourceDictionary ( )
228228 {
229- return GetResourceDictionary ( Settings . Theme ) ;
229+ return GetResourceDictionary ( _settings . Theme ) ;
230230 }
231231
232232 public List < ThemeData > LoadAvailableThemes ( )
0 commit comments