客户端的颜色配置存储在了本地,客户端下次运行将直接恢复之前的颜色设置。
This commit is contained in:
@@ -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<MaterialDesignThemes.Wpf.Palette>();
|
||||
new PaletteHelper().ReplacePalette(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void NameTextBox_KeyDown(object sender, KeyEventArgs e)
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
</DataTemplate>
|
||||
</UserControl.Resources>
|
||||
<DockPanel>
|
||||
<wpf:Card DockPanel.Dock="Top" Margin="2">
|
||||
<wpf:Card DockPanel.Dock="Top" Margin="2,0,2,0">
|
||||
<DockPanel>
|
||||
<local:Palette DockPanel.Dock="Left" Width="200" />
|
||||
<TextBlock Margin="16" TextWrapping="Wrap" VerticalAlignment="Center">这是你当前的主题配色,可以在app.xaml中进行配置和初始化,
|
||||
|
||||
Reference in New Issue
Block a user