From f6ded5b1ef92c7e90dfa9ba746c14b370555bac6 Mon Sep 17 00:00:00 2001 From: dathlin Date: Mon, 17 Jul 2017 14:50:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=E7=9A=84=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E9=85=8D=E7=BD=AE=E5=AD=98=E5=82=A8=E5=9C=A8=E4=BA=86?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=EF=BC=8C=E5=AE=A2=E6=88=B7=E7=AB=AF=E4=B8=8B?= =?UTF-8?q?=E6=AC=A1=E8=BF=90=E8=A1=8C=E5=B0=86=E7=9B=B4=E6=8E=A5=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=E4=B9=8B=E5=89=8D=E7=9A=84=E9=A2=9C=E8=89=B2=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 软件系统客户端Wpf/LoginWindow.xaml.cs | 13 +++++++++++++ 软件系统客户端Wpf/MainWindow.xaml.cs | 7 +++++++ 软件系统客户端Wpf/Views/UserPaletteSelector.xaml | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) 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中进行配置和初始化,