delete lazy code in viewmodels
This commit is contained in:
1 parent
066cedeb73
commit
700f54ab2b
23 files changed
+141
-214
No files matched your search
@@ -214,7 +214,13 @@ namespace HandyControl.Themes
|
||||
|
||||
private void UpdateSkin() => MergedDictionaries[0] = GetSkin(Skin);
|
||||
|
||||
public virtual ResourceDictionary GetTheme() => ResourceHelper.GetTheme();
|
||||
private ResourceDictionary _theme;
|
||||
|
||||
public virtual ResourceDictionary GetTheme()
|
||||
{
|
||||
_theme ??= ResourceHelper.GetTheme();
|
||||
return _theme;
|
||||
}
|
||||
|
||||
private void InitResource()
|
||||
{
|
||||
@@ -231,6 +237,6 @@ namespace HandyControl.Themes
|
||||
|
||||
public class StandaloneTheme : Theme
|
||||
{
|
||||
public override ResourceDictionary GetTheme() => ResourceHelper.GetTheme(true);
|
||||
public override ResourceDictionary GetTheme() => ResourceHelper.GetTheme();
|
||||
}
|
||||
}
|
||||
@@ -79,28 +79,12 @@ namespace HandyControl.Tools
|
||||
Source = new Uri($"pack://application:,,,/HandyControl;component/Themes/Skin{skin}.xaml")
|
||||
};
|
||||
|
||||
private static ResourceDictionary HcTheme;
|
||||
|
||||
/// <summary>
|
||||
/// get HandyControl theme
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ResourceDictionary GetTheme(bool standalone = false)
|
||||
public static ResourceDictionary GetTheme() => new()
|
||||
{
|
||||
if (!standalone)
|
||||
{
|
||||
HcTheme ??= new ResourceDictionary
|
||||
{
|
||||
Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Theme.xaml")
|
||||
};
|
||||
|
||||
return HcTheme;
|
||||
}
|
||||
|
||||
return new ResourceDictionary
|
||||
{
|
||||
Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Theme.xaml")
|
||||
};
|
||||
}
|
||||
Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Theme.xaml")
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user