diff --git a/Wox.Core/Theme/Theme.cs b/Wox.Core/Theme/Theme.cs index e9f55a83ad..9475a9fa22 100644 --- a/Wox.Core/Theme/Theme.cs +++ b/Wox.Core/Theme/Theme.cs @@ -59,16 +59,11 @@ namespace Wox.Core.Theme UserSettingStorage.Instance.Save(); ResourceMerger.UpdateResource(this); - try - { - var isBlur = Application.Current.FindResource("ThemeBlurEnabled"); - if (isBlur is bool) - { - SetBlurForWindow(Application.Current.MainWindow, (bool)isBlur); - } - } - catch (ResourceReferenceKeyNotFoundException e) + // Exception of FindResource can't be cathed if global exception handle is set + var isBlur = Application.Current.TryFindResource("ThemeBlurEnabled"); + if (isBlur is bool) { + SetBlurForWindow(Application.Current.MainWindow, (bool)isBlur); } } diff --git a/Wox.Core/i18n/Internationalization.cs b/Wox.Core/i18n/Internationalization.cs index 5ce242f187..f2ad412da2 100644 --- a/Wox.Core/i18n/Internationalization.cs +++ b/Wox.Core/i18n/Internationalization.cs @@ -88,20 +88,15 @@ namespace Wox.Core.i18n public string GetTranslation(string key) { - try + var translation = Application.Current.TryFindResource(key); + if (translation is string) { - object translation = Application.Current.FindResource(key); - if (translation == null) - { - return "NoTranslation"; - } return translation.ToString(); } - catch + else { return "NoTranslation"; } - } private string GetLanguagePath(string languageCode)