HandyControl/HandyControlDemo/App.xaml.cs
NaBian 0b80e7ddec add NumericUpDownPlus style
now you can clear, verify the value of NumericUpDown
2018-11-07 16:54:33 +08:00

55 lines
1.7 KiB
C#

using System;
using System.Globalization;
using System.Threading;
using System.Windows;
using HandyControl.Data;
using HandyControl.Tools;
using HandyControlDemo.Data;
namespace HandyControlDemo
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
GlobalData.Init();
Thread.CurrentThread.CurrentUICulture = new CultureInfo(GlobalData.Config.Lang);
if (GlobalData.Config.Skin != SkinType.Default)
{
UpdateSkin(GlobalData.Config.Skin);
}
}
protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
GlobalData.Save();
}
internal void UpdateSkin(SkinType skin)
{
var skins0 = Resources.MergedDictionaries[0];
skins0.MergedDictionaries.Clear();
skins0.MergedDictionaries.Add(ResourceHelper.GetSkin(skin));
skins0.MergedDictionaries.Add(ResourceHelper.GetSkin(typeof(App).Assembly, "Resources/Themes", skin));
var skins1 = Resources.MergedDictionaries[1];
skins1.MergedDictionaries.Clear();
skins1.MergedDictionaries.Add(new ResourceDictionary
{
Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Theme.xaml")
});
skins1.MergedDictionaries.Add(new ResourceDictionary
{
Source = new Uri("pack://application:,,,/HandyControlDemo;component/Resources/Themes/Theme.xaml")
});
}
}
}