@@ -145,11 +145,9 @@ private ResourceDictionary CurrentThemeResourceDictionary()
145145 public ResourceDictionary GetResourceDictionary ( )
146146 {
147147 var dict = CurrentThemeResourceDictionary ( ) ;
148-
149- Style queryBoxStyle = dict [ "QueryBoxStyle" ] as Style ;
150- Style querySuggestionBoxStyle = dict [ "QuerySuggestionBoxStyle" ] as Style ;
151-
152- if ( queryBoxStyle != null && querySuggestionBoxStyle != null )
148+
149+ if ( dict [ "QueryBoxStyle" ] is Style queryBoxStyle &&
150+ dict [ "QuerySuggestionBoxStyle" ] is Style querySuggestionBoxStyle )
153151 {
154152 var fontFamily = new FontFamily ( Settings . QueryBoxFont ) ;
155153 var fontStyle = FontHelper . GetFontStyleFromInvariantStringOrNormal ( Settings . QueryBoxFontStyle ) ;
@@ -174,19 +172,22 @@ public ResourceDictionary GetResourceDictionary()
174172 querySuggestionBoxStyle . Setters . Add ( new Setter ( TextBox . FontStretchProperty , fontStretch ) ) ;
175173 }
176174
177- Style resultItemStyle = dict [ "ItemTitleStyle" ] as Style ;
178- Style resultSubItemStyle = dict [ "ItemSubTitleStyle" ] as Style ;
179- Style resultItemSelectedStyle = dict [ "ItemTitleSelectedStyle" ] as Style ;
180- Style resultSubItemSelectedStyle = dict [ "ItemSubTitleSelectedStyle" ] as Style ;
181- if ( resultItemStyle != null && resultSubItemStyle != null && resultSubItemSelectedStyle != null && resultItemSelectedStyle != null )
175+ if ( dict [ "ItemTitleStyle" ] is Style resultItemStyle &&
176+ dict [ "ItemSubTitleStyle" ] is Style resultSubItemStyle &&
177+ dict [ "ItemSubTitleSelectedStyle" ] is Style resultSubItemSelectedStyle &&
178+ dict [ "ItemTitleSelectedStyle" ] is Style resultItemSelectedStyle &&
179+ dict [ "ItemHotkeyStyle" ] is Style resultHotkeyItemStyle &&
180+ dict [ "ItemHotkeySelectedStyle" ] is Style resultHotkeyItemSelectedStyle )
182181 {
183182 Setter fontFamily = new Setter ( TextBlock . FontFamilyProperty , new FontFamily ( Settings . ResultFont ) ) ;
184183 Setter fontStyle = new Setter ( TextBlock . FontStyleProperty , FontHelper . GetFontStyleFromInvariantStringOrNormal ( Settings . ResultFontStyle ) ) ;
185184 Setter fontWeight = new Setter ( TextBlock . FontWeightProperty , FontHelper . GetFontWeightFromInvariantStringOrNormal ( Settings . ResultFontWeight ) ) ;
186185 Setter fontStretch = new Setter ( TextBlock . FontStretchProperty , FontHelper . GetFontStretchFromInvariantStringOrNormal ( Settings . ResultFontStretch ) ) ;
187186
188187 Setter [ ] setters = { fontFamily , fontStyle , fontWeight , fontStretch } ;
189- Array . ForEach ( new [ ] { resultItemStyle , resultSubItemStyle , resultItemSelectedStyle , resultSubItemSelectedStyle } , o => Array . ForEach ( setters , p => o . Setters . Add ( p ) ) ) ;
188+ Array . ForEach (
189+ new [ ] { resultItemStyle , resultSubItemStyle , resultItemSelectedStyle , resultSubItemSelectedStyle , resultHotkeyItemStyle , resultHotkeyItemSelectedStyle } , o
190+ => Array . ForEach ( setters , p => o . Setters . Add ( p ) ) ) ;
190191 }
191192
192193 var windowStyle = dict [ "WindowStyle" ] as Style ;
@@ -236,17 +237,19 @@ private string GetThemePath(string themeName)
236237
237238 public void AddDropShadowEffectToCurrentTheme ( )
238239 {
239- var dict = CurrentThemeResourceDictionary ( ) ;
240+ var dict = GetResourceDictionary ( ) ;
240241
241242 var windowBorderStyle = dict [ "WindowBorderStyle" ] as Style ;
242243
243- var effectSetter = new Setter ( ) ;
244- effectSetter . Property = Border . EffectProperty ;
245- effectSetter . Value = new DropShadowEffect
244+ var effectSetter = new Setter
246245 {
247- Opacity = 0.9 ,
248- ShadowDepth = 2 ,
249- BlurRadius = 15
246+ Property = Border . EffectProperty ,
247+ Value = new DropShadowEffect
248+ {
249+ Opacity = 0.4 ,
250+ ShadowDepth = 2 ,
251+ BlurRadius = 15
252+ }
250253 } ;
251254
252255 var marginSetter = windowBorderStyle . Setters . FirstOrDefault ( setterBase => setterBase is Setter setter && setter . Property == Border . MarginProperty ) as Setter ;
@@ -261,7 +264,7 @@ public void AddDropShadowEffectToCurrentTheme()
261264 }
262265 else
263266 {
264- var baseMargin = ( Thickness ) marginSetter . Value ;
267+ var baseMargin = ( Thickness ) marginSetter . Value ;
265268 var newMargin = new Thickness (
266269 baseMargin . Left + ShadowExtraMargin ,
267270 baseMargin . Top + ShadowExtraMargin ,
@@ -282,8 +285,8 @@ public void RemoveDropShadowEffectFromCurrentTheme()
282285
283286 var effectSetter = windowBorderStyle . Setters . FirstOrDefault ( setterBase => setterBase is Setter setter && setter . Property == Border . EffectProperty ) as Setter ;
284287 var marginSetter = windowBorderStyle . Setters . FirstOrDefault ( setterBase => setterBase is Setter setter && setter . Property == Border . MarginProperty ) as Setter ;
285-
286- if ( effectSetter != null )
288+
289+ if ( effectSetter != null )
287290 {
288291 windowBorderStyle . Setters . Remove ( effectSetter ) ;
289292 }
@@ -371,11 +374,11 @@ private bool IsBlurTheme()
371374 private void SetWindowAccent ( Window w , AccentState state )
372375 {
373376 var windowHelper = new WindowInteropHelper ( w ) ;
374-
377+
375378 // this determines the width of the main query window
376379 w . Width = mainWindowWidth ;
377380 windowHelper . EnsureHandle ( ) ;
378-
381+
379382 var accent = new AccentPolicy { AccentState = state } ;
380383 var accentStructSize = Marshal . SizeOf ( accent ) ;
381384
0 commit comments