diff --git a/软件系统客户端Wpf/LoginWindow.xaml.cs b/软件系统客户端Wpf/LoginWindow.xaml.cs index 7be5637..49cab21 100644 --- a/软件系统客户端Wpf/LoginWindow.xaml.cs +++ b/软件系统客户端Wpf/LoginWindow.xaml.cs @@ -19,6 +19,7 @@ using HslCommunication.BasicFramework; using Newtonsoft.Json.Linq; using ClientsLibrary; using MaterialDesignThemes.Wpf; +using System.IO; namespace 软件系统客户端Wpf { @@ -320,6 +321,18 @@ namespace 软件系统客户端Wpf if (UserClient.JsonSettings.Password != "") LoginButton.Focus(); else if (UserClient.JsonSettings.LoginName != "") PasswordBox.Focus(); else NameTextBox.Focus(); + + + + if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\Palette.txt")) + { + using (StreamReader sr = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + @"\Palette.txt", Encoding.UTF8)) + { + string temp = sr.ReadToEnd(); + MaterialDesignThemes.Wpf.Palette obj = JObject.Parse(temp).ToObject(); + new PaletteHelper().ReplacePalette(obj); + } + } } private void NameTextBox_KeyDown(object sender, KeyEventArgs e) diff --git a/软件系统客户端Wpf/MainWindow.xaml.cs b/软件系统客户端Wpf/MainWindow.xaml.cs index fcb8f04..b93a457 100644 --- a/软件系统客户端Wpf/MainWindow.xaml.cs +++ b/软件系统客户端Wpf/MainWindow.xaml.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.IO; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; @@ -83,6 +84,12 @@ namespace 软件系统客户端Wpf //通知服务器退出网络服务 net_socket_client.ClientClose(); + //保存当前的颜色选择 + var p = new PaletteHelper().QueryPalette(); + using (StreamWriter sw = new StreamWriter(AppDomain.CurrentDomain.BaseDirectory + @"\Palette.txt", false, Encoding.UTF8)) + { + sw.Write(JObject.FromObject(p).ToString()); + } //等待一秒退出 using (FormWaitInfomation fwm = new FormWaitInfomation("正在退出程序...", 1000)) { diff --git a/软件系统客户端Wpf/Views/UserPaletteSelector.xaml b/软件系统客户端Wpf/Views/UserPaletteSelector.xaml index 9caa258..321ca8a 100644 --- a/软件系统客户端Wpf/Views/UserPaletteSelector.xaml +++ b/软件系统客户端Wpf/Views/UserPaletteSelector.xaml @@ -82,7 +82,7 @@ - + 这是你当前的主题配色,可以在app.xaml中进行配置和初始化,