Refactor theme resource dictionary retrieval logic

Replaced separate calls to GetResourceDictionary and UpdateResourceDictionary with a single GetThemeResourceDictionary call in Theme.cs. Updated blur enablement check to use the new dictionary variable, simplifying theme resource management.
This commit is contained in:
Jack251970 2026-03-09 18:35:35 +08:00
parent 916b4ff091
commit c0134d5692

View file

@ -418,11 +418,6 @@ namespace Flow.Launcher.Core.Resource
if (string.IsNullOrEmpty(path))
throw new DirectoryNotFoundException($"Theme path can't be found <{path}>");
// Retrieve theme resource always use the resource with font settings applied.
var resourceDict = GetResourceDictionary(theme);
UpdateResourceDictionary(resourceDict);
_settings.Theme = theme;
// Always allow re-loading default theme, in case of failure of switching to a new theme from default theme
@ -432,7 +427,8 @@ namespace Flow.Launcher.Core.Resource
}
// Check if blur is enabled
BlurEnabled = Win32Helper.IsBackdropSupported() && IsThemeBlurEnabled(resourceDict);
var dict = GetThemeResourceDictionary(theme);
BlurEnabled = Win32Helper.IsBackdropSupported() && IsThemeBlurEnabled(dict);
// Apply blur and drop shadow effect so that we do not need to call it again
_ = RefreshFrameAsync();