diff --git a/HandyControl/Controls/Growl.cs b/HandyControl/Controls/Growl.cs
index 7fe15efa..b56772d7 100644
--- a/HandyControl/Controls/Growl.cs
+++ b/HandyControl/Controls/Growl.cs
@@ -388,9 +388,11 @@ namespace HandyControl.Controls
/// 询问
///
///
- public static void Ask(string message) => Ask(new GrowlInfo
+ ///
+ public static void Ask(string message, Func actionBeforeClose) => Ask(new GrowlInfo
{
- Message = message
+ Message = message,
+ ActionBeforeClose = actionBeforeClose
});
///
diff --git a/HandyControl/Themes/Styles/Base/CheckBoxBaseStyle.xaml b/HandyControl/Themes/Styles/Base/CheckBoxBaseStyle.xaml
index a3b43856..75269a20 100644
--- a/HandyControl/Themes/Styles/Base/CheckBoxBaseStyle.xaml
+++ b/HandyControl/Themes/Styles/Base/CheckBoxBaseStyle.xaml
@@ -7,6 +7,8 @@
+
+
diff --git a/HandyControl/Themes/Styles/Base/RadioButtonBaseStyle.xaml b/HandyControl/Themes/Styles/Base/RadioButtonBaseStyle.xaml
index 23567c7a..369d8dab 100644
--- a/HandyControl/Themes/Styles/Base/RadioButtonBaseStyle.xaml
+++ b/HandyControl/Themes/Styles/Base/RadioButtonBaseStyle.xaml
@@ -7,6 +7,8 @@
+
+
@@ -44,7 +46,7 @@
-
+
diff --git a/HandyControl/Themes/Styles/RadioButton.xaml b/HandyControl/Themes/Styles/RadioButton.xaml
index 673b13c2..20051738 100644
--- a/HandyControl/Themes/Styles/RadioButton.xaml
+++ b/HandyControl/Themes/Styles/RadioButton.xaml
@@ -1,9 +1,13 @@
-
+
+
+
+
\ No newline at end of file
diff --git a/HandyControl/Themes/Styles/ToggleButton.xaml b/HandyControl/Themes/Styles/ToggleButton.xaml
index a2e5213c..58670e6f 100644
--- a/HandyControl/Themes/Styles/ToggleButton.xaml
+++ b/HandyControl/Themes/Styles/ToggleButton.xaml
@@ -106,6 +106,8 @@
+
+
diff --git a/HandyControl/Themes/Styles/TreeView.xaml b/HandyControl/Themes/Styles/TreeView.xaml
index 15ac95fd..a4f59301 100644
--- a/HandyControl/Themes/Styles/TreeView.xaml
+++ b/HandyControl/Themes/Styles/TreeView.xaml
@@ -100,7 +100,6 @@
-
diff --git a/HandyControlDemo/App.xaml.cs b/HandyControlDemo/App.xaml.cs
index 2d467979..83fac9e5 100644
--- a/HandyControlDemo/App.xaml.cs
+++ b/HandyControlDemo/App.xaml.cs
@@ -1,6 +1,7 @@
using System.Globalization;
using System.Threading;
using System.Windows;
+using HandyControlDemo.Data;
namespace HandyControlDemo
{
@@ -12,7 +13,15 @@ namespace HandyControlDemo
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
- Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");
+
+ GlobalData.Init();
+ Thread.CurrentThread.CurrentUICulture = new CultureInfo(GlobalData.Config.Lang);
+ }
+
+ protected override void OnExit(ExitEventArgs e)
+ {
+ base.OnExit(e);
+ GlobalData.Save();
}
}
}
diff --git a/HandyControlDemo/Data/AppConfig.cs b/HandyControlDemo/Data/AppConfig.cs
new file mode 100644
index 00000000..5ebf2226
--- /dev/null
+++ b/HandyControlDemo/Data/AppConfig.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace HandyControlDemo.Data
+{
+ internal class AppConfig
+ {
+ public static string SavePath = $"{AppDomain.CurrentDomain.BaseDirectory}AppConfig.json";
+
+ public string Lang { get; set; } = "cn";
+ }
+}
\ No newline at end of file
diff --git a/HandyControlDemo/Data/GlobalData.cs b/HandyControlDemo/Data/GlobalData.cs
new file mode 100644
index 00000000..a32bedb8
--- /dev/null
+++ b/HandyControlDemo/Data/GlobalData.cs
@@ -0,0 +1,29 @@
+using System.IO;
+using Newtonsoft.Json;
+
+namespace HandyControlDemo.Data
+{
+ internal class GlobalData
+ {
+ public static void Init()
+ {
+ if (File.Exists(AppConfig.SavePath))
+ {
+ var json = File.ReadAllText(AppConfig.SavePath);
+ Config = JsonConvert.DeserializeObject(json);
+ }
+ else
+ {
+ Config = new AppConfig();
+ }
+ }
+
+ public static void Save()
+ {
+ var json = JsonConvert.SerializeObject(Config);
+ File.WriteAllText(AppConfig.SavePath, json);
+ }
+
+ public static AppConfig Config { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/HandyControlDemo/HandyControlDemo.csproj b/HandyControlDemo/HandyControlDemo.csproj
index 4c256bb6..47698e5a 100644
--- a/HandyControlDemo/HandyControlDemo.csproj
+++ b/HandyControlDemo/HandyControlDemo.csproj
@@ -46,6 +46,9 @@
..\packages\MvvmLightLibs.5.4.1\lib\net45\GalaSoft.MvvmLight.Platform.dll
+
+ ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll
+
@@ -62,7 +65,9 @@
MSBuild:Compile
Designer
+
+
True
True
@@ -447,40 +452,42 @@
TextTemplatingFileGenerator
MessageToken.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/HandyControlDemo/Properties/Langs/Lang.Designer.cs b/HandyControlDemo/Properties/Langs/Lang.Designer.cs
index 8a25c494..db1e9799 100644
--- a/HandyControlDemo/Properties/Langs/Lang.Designer.cs
+++ b/HandyControlDemo/Properties/Langs/Lang.Designer.cs
@@ -69,6 +69,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 询问 的本地化字符串。
+ ///
+ public static string Ask {
+ get {
+ return ResourceManager.GetString("Ask", resourceCulture);
+ }
+ }
+
///
/// 查找类似 填写基本信息 的本地化字符串。
///
@@ -123,6 +132,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 是否重启以更改语言? 的本地化字符串。
+ ///
+ public static string ChangeLangAsk {
+ get {
+ return ResourceManager.GetString("ChangeLangAsk", resourceCulture);
+ }
+ }
+
///
/// 查找类似 复选框 的本地化字符串。
///
@@ -141,6 +159,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 清空 的本地化字符串。
+ ///
+ public static string Clear {
+ get {
+ return ResourceManager.GetString("Clear", resourceCulture);
+ }
+ }
+
///
/// 查找类似 时钟 的本地化字符串。
///
@@ -240,6 +267,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 错误 的本地化字符串。
+ ///
+ public static string Error {
+ get {
+ return ResourceManager.GetString("Error", resourceCulture);
+ }
+ }
+
///
/// 查找类似 展开框 的本地化字符串。
///
@@ -249,6 +285,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 严重 的本地化字符串。
+ ///
+ public static string Fatal {
+ get {
+ return ResourceManager.GetString("Fatal", resourceCulture);
+ }
+ }
+
///
/// 查找类似 信息通知 的本地化字符串。
///
diff --git a/HandyControlDemo/Properties/Langs/Lang.en.resx b/HandyControlDemo/Properties/Langs/Lang.en.resx
index d574cc16..eab48829 100644
--- a/HandyControlDemo/Properties/Langs/Lang.en.resx
+++ b/HandyControlDemo/Properties/Langs/Lang.en.resx
@@ -345,4 +345,19 @@
Ignore
+
+ Error
+
+
+ Ask
+
+
+ Fatal
+
+
+ Clear
+
+
+ Whether to restart to change the language?
+
\ No newline at end of file
diff --git a/HandyControlDemo/Properties/Langs/Lang.resx b/HandyControlDemo/Properties/Langs/Lang.resx
index 68ed1b53..a2df44a9 100644
--- a/HandyControlDemo/Properties/Langs/Lang.resx
+++ b/HandyControlDemo/Properties/Langs/Lang.resx
@@ -325,4 +325,19 @@
忽略
+
+ 错误
+
+
+ 询问
+
+
+ 严重
+
+
+ 清空
+
+
+ 是否重启以更改语言?
+
\ No newline at end of file
diff --git a/HandyControlDemo/Resources/Img/Flag/cn.png b/HandyControlDemo/Resources/Img/Flag/cn.png
new file mode 100644
index 00000000..63267f70
Binary files /dev/null and b/HandyControlDemo/Resources/Img/Flag/cn.png differ
diff --git a/HandyControlDemo/Resources/Img/Flag/en.png b/HandyControlDemo/Resources/Img/Flag/en.png
new file mode 100644
index 00000000..18425bc6
Binary files /dev/null and b/HandyControlDemo/Resources/Img/Flag/en.png differ
diff --git a/HandyControlDemo/Resources/Img/BorderElement_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/BorderElement_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/BorderElement_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/BorderElement_16x.png
diff --git a/HandyControlDemo/Resources/Img/ButtonClick_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/ButtonClick_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/ButtonClick_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/ButtonClick_16x.png
diff --git a/HandyControlDemo/Resources/Img/Calendar_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/Calendar_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/Calendar_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/Calendar_16x.png
diff --git a/HandyControlDemo/Resources/Img/Carousel_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/Carousel_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/Carousel_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/Carousel_16x.png
diff --git a/HandyControlDemo/Resources/Img/CheckBox_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/CheckBox_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/CheckBox_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/CheckBox_16x.png
diff --git a/HandyControlDemo/Resources/Img/ColorPalette_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/ColorPalette_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/ColorPalette_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/ColorPalette_16x.png
diff --git a/HandyControlDemo/Resources/Img/ComboBox_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/ComboBox_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/ComboBox_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/ComboBox_16x.png
diff --git a/HandyControlDemo/Resources/Img/ContextMenu_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/ContextMenu_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/ContextMenu_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/ContextMenu_16x.png
diff --git a/HandyControlDemo/Resources/Img/DataGrid_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/DataGrid_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/DataGrid_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/DataGrid_16x.png
diff --git a/HandyControlDemo/Resources/Img/DatePicker_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/DatePicker_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/DatePicker_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/DatePicker_16x.png
diff --git a/HandyControlDemo/Resources/Img/Expander_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/Expander_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/Expander_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/Expander_16x.png
diff --git a/HandyControlDemo/Resources/Img/Flow_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/Flow_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/Flow_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/Flow_16x.png
diff --git a/HandyControlDemo/Resources/Img/ImageBrowser_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/ImageBrowser_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/ImageBrowser_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/ImageBrowser_16x.png
diff --git a/HandyControlDemo/Resources/Img/ListBox_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/ListBox_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/ListBox_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/ListBox_16x.png
diff --git a/HandyControlDemo/Resources/Img/Loading_Blue_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/Loading_Blue_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/Loading_Blue_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/Loading_Blue_16x.png
diff --git a/HandyControlDemo/Resources/Img/Message_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/Message_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/Message_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/Message_16x.png
diff --git a/HandyControlDemo/Resources/Img/NumericListBox_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/NumericListBox_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/NumericListBox_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/NumericListBox_16x.png
diff --git a/HandyControlDemo/Resources/Img/Paginator_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/Paginator_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/Paginator_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/Paginator_16x.png
diff --git a/HandyControlDemo/Resources/Img/PasswordBox_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/PasswordBox_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/PasswordBox_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/PasswordBox_16x.png
diff --git a/HandyControlDemo/Resources/Img/Path_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/Path_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/Path_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/Path_16x.png
diff --git a/HandyControlDemo/Resources/Img/ProgressBar_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/ProgressBar_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/ProgressBar_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/ProgressBar_16x.png
diff --git a/HandyControlDemo/Resources/Img/RadioButton_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/RadioButton_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/RadioButton_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/RadioButton_16x.png
diff --git a/HandyControlDemo/Resources/Img/ScrollBox_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/ScrollBox_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/ScrollBox_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/ScrollBox_16x.png
diff --git a/HandyControlDemo/Resources/Img/ShapeArcRing_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/ShapeArcRing_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/ShapeArcRing_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/ShapeArcRing_16x.png
diff --git a/HandyControlDemo/Resources/Img/SplitterControl_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/SplitterControl_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/SplitterControl_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/SplitterControl_16x.png
diff --git a/HandyControlDemo/Resources/Img/TabPage_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/TabPage_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/TabPage_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/TabPage_16x.png
diff --git a/HandyControlDemo/Resources/Img/TextBlock_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/TextBlock_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/TextBlock_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/TextBlock_16x.png
diff --git a/HandyControlDemo/Resources/Img/TextBox_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/TextBox_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/TextBox_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/TextBox_16x.png
diff --git a/HandyControlDemo/Resources/Img/TimePicker_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/TimePicker_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/TimePicker_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/TimePicker_16x.png
diff --git a/HandyControlDemo/Resources/Img/Time_color_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/Time_color_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/Time_color_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/Time_color_16x.png
diff --git a/HandyControlDemo/Resources/Img/Timeline_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/Timeline_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/Timeline_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/Timeline_16x.png
diff --git a/HandyControlDemo/Resources/Img/Toggle_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/Toggle_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/Toggle_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/Toggle_16x.png
diff --git a/HandyControlDemo/Resources/Img/TreeView_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/TreeView_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/TreeView_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/TreeView_16x.png
diff --git a/HandyControlDemo/Resources/Img/WindowsForm_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/WindowsForm_16x.png
similarity index 100%
rename from HandyControlDemo/Resources/Img/WindowsForm_16x.png
rename to HandyControlDemo/Resources/Img/LeftMainContent/WindowsForm_16x.png
diff --git a/HandyControlDemo/UserControl/Controls/GrowlDemoCtl.xaml b/HandyControlDemo/UserControl/Controls/GrowlDemoCtl.xaml
index faff8901..0f813ec7 100644
--- a/HandyControlDemo/UserControl/Controls/GrowlDemoCtl.xaml
+++ b/HandyControlDemo/UserControl/Controls/GrowlDemoCtl.xaml
@@ -2,17 +2,18 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
+ xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
DataContext="{Binding GrowlDemo,Source={StaticResource Locator}}"
Background="White">
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/HandyControlDemo/UserControl/Main/LeftMainContent.xaml b/HandyControlDemo/UserControl/Main/LeftMainContent.xaml
index ad21c087..677fa899 100644
--- a/HandyControlDemo/UserControl/Main/LeftMainContent.xaml
+++ b/HandyControlDemo/UserControl/Main/LeftMainContent.xaml
@@ -17,97 +17,97 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -116,87 +116,87 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/HandyControlDemo/UserControl/Main/NoUserContent.xaml b/HandyControlDemo/UserControl/Main/NoUserContent.xaml
index bc77a5db..aee5a4ce 100644
--- a/HandyControlDemo/UserControl/Main/NoUserContent.xaml
+++ b/HandyControlDemo/UserControl/Main/NoUserContent.xaml
@@ -1,30 +1,51 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HandyControlDemo/UserControl/Main/NoUserContent.xaml.cs b/HandyControlDemo/UserControl/Main/NoUserContent.xaml.cs
index 0242de49..d6efb4c9 100644
--- a/HandyControlDemo/UserControl/Main/NoUserContent.xaml.cs
+++ b/HandyControlDemo/UserControl/Main/NoUserContent.xaml.cs
@@ -1,14 +1,43 @@
-// ReSharper disable once CheckNamespace
+using System;
+using System.Diagnostics;
+using System.Reflection;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using HandyControl.Controls;
+using HandyControlDemo.Data;
+
+// ReSharper disable once CheckNamespace
namespace HandyControlDemo.UserControl
{
- ///
- /// NoUserContent.xaml 的交互逻辑
- ///
public partial class NoUserContent
{
public NoUserContent()
{
InitializeComponent();
+
+ ImageLang.Source = BitmapFrame.Create(new Uri($"pack://application:,,,/HandyControlDemo;component/Resources/Img/Flag/{GlobalData.Config.Lang}.png"));
+ }
+
+ private void ButtonLang_OnClick(object sender, RoutedEventArgs e) => PopupLang.IsOpen = true;
+
+ private void ButtonLangs_OnClick(object sender, RoutedEventArgs e)
+ {
+ if (e.OriginalSource is Button button && button.Tag is string tag)
+ {
+ PopupLang.IsOpen = false;
+ if (tag.Equals(GlobalData.Config.Lang)) return;
+ Growl.Ask(Properties.Langs.Lang.ChangeLangAsk, b =>
+ {
+ if (!b) return true;
+ GlobalData.Config.Lang = tag;
+ GlobalData.Save();
+ Process.Start(Assembly.GetExecutingAssembly().Location);
+ Environment.Exit(0);
+ return true;
+ });
+ }
}
}
}
diff --git a/HandyControlDemo/ViewModel/GrowlDemoViewModel.cs b/HandyControlDemo/ViewModel/GrowlDemoViewModel.cs
index 8ada523e..e752c50c 100644
--- a/HandyControlDemo/ViewModel/GrowlDemoViewModel.cs
+++ b/HandyControlDemo/ViewModel/GrowlDemoViewModel.cs
@@ -29,14 +29,10 @@ namespace HandyControlDemo.ViewModel
new RelayCommand(() => Growl.Error(Properties.Langs.Lang.GrowlError))).Value;
public RelayCommand AskCmd => new Lazy(() =>
- new RelayCommand(() => Growl.Ask(new GrowlInfo
+ new RelayCommand(() => Growl.Ask(Properties.Langs.Lang.GrowlAsk, isConfirmed =>
{
- Message = Properties.Langs.Lang.GrowlAsk,
- ActionBeforeClose = isConfirmed =>
- {
- Growl.Info(isConfirmed.ToString());
- return true;
- }
+ Growl.Info(isConfirmed.ToString());
+ return true;
}))).Value;
public RelayCommand FatalCmd => new Lazy(() =>
diff --git a/HandyControlDemo/packages.config b/HandyControlDemo/packages.config
index 59fa3173..d4e90a24 100644
--- a/HandyControlDemo/packages.config
+++ b/HandyControlDemo/packages.config
@@ -2,4 +2,5 @@
+
\ No newline at end of file