mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-14 19:49:15 +08:00
Fix FindResource
http://windowsasusual.blogspot.ie/2015/10/wpf-applicationcurrentfindresource-and.html
This commit is contained in:
parent
5b8fa5ec8d
commit
7b386c4f41
@ -59,16 +59,11 @@ namespace Wox.Core.Theme
|
|||||||
UserSettingStorage.Instance.Save();
|
UserSettingStorage.Instance.Save();
|
||||||
ResourceMerger.UpdateResource(this);
|
ResourceMerger.UpdateResource(this);
|
||||||
|
|
||||||
try
|
// Exception of FindResource can't be cathed if global exception handle is set
|
||||||
{
|
var isBlur = Application.Current.TryFindResource("ThemeBlurEnabled");
|
||||||
var isBlur = Application.Current.FindResource("ThemeBlurEnabled");
|
if (isBlur is bool)
|
||||||
if (isBlur is bool)
|
|
||||||
{
|
|
||||||
SetBlurForWindow(Application.Current.MainWindow, (bool)isBlur);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (ResourceReferenceKeyNotFoundException e)
|
|
||||||
{
|
{
|
||||||
|
SetBlurForWindow(Application.Current.MainWindow, (bool)isBlur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,20 +88,15 @@ namespace Wox.Core.i18n
|
|||||||
|
|
||||||
public string GetTranslation(string key)
|
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();
|
return translation.ToString();
|
||||||
}
|
}
|
||||||
catch
|
else
|
||||||
{
|
{
|
||||||
return "NoTranslation";
|
return "NoTranslation";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetLanguagePath(string languageCode)
|
private string GetLanguagePath(string languageCode)
|
||||||
|
Loading…
Reference in New Issue
Block a user