From 5003ea93f802e44fa40405aeadde45616c4c7638 Mon Sep 17 00:00:00 2001 From: chfei Date: Mon, 5 Oct 2026 13:43:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=BE=E7=BD=AE=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=20=E5=A2=9E=E5=8A=A0=E7=A4=BC=E7=89=A9=E5=8F=91?= =?UTF-8?q?=E8=B4=A7=20=E8=B6=85=E5=87=BA6=E5=85=83=20=E5=88=99=E5=8F=91?= =?UTF-8?q?=E7=A4=BC=E7=89=A9=E4=BA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 29WxOrderWpf/App.xaml | 1 + .../Ctrls/OrderCtrls/OrderListCtrl.xaml | 1 + 29WxOrderWpf/Ctrls/Settings/SettingsView.xaml | 252 ++++++++++++++++++ .../Ctrls/Settings/SettingsView.xaml.cs | 57 ++++ 29WxOrderWpf/MainWindow.xaml | 100 ++++--- 29WxOrderWpf/MainWindow.xaml.cs | 10 +- 29WxOrderWpf/Services/ShipGiftService.cs | 9 +- 29WxOrderWpf/Styles/TabControlStyle.xaml | 197 ++++++++++++++ 29WxOrderWpf/ViewModels/SettingViewModel.cs | 40 +++ AllBase/BaseClass.cs | 3 +- AllBase/Model/Config/SettingConfig.cs | 18 ++ 11 files changed, 642 insertions(+), 46 deletions(-) create mode 100644 29WxOrderWpf/Ctrls/Settings/SettingsView.xaml create mode 100644 29WxOrderWpf/Ctrls/Settings/SettingsView.xaml.cs create mode 100644 29WxOrderWpf/Styles/TabControlStyle.xaml create mode 100644 29WxOrderWpf/ViewModels/SettingViewModel.cs create mode 100644 AllBase/Model/Config/SettingConfig.cs diff --git a/29WxOrderWpf/App.xaml b/29WxOrderWpf/App.xaml index e1b9953..d3fae9d 100644 --- a/29WxOrderWpf/App.xaml +++ b/29WxOrderWpf/App.xaml @@ -35,6 +35,7 @@ + diff --git a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml index 84741f1..ece4d20 100644 --- a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml +++ b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml @@ -10,6 +10,7 @@ xmlns:usercontrols="clr-namespace:_29WxOrderWpf.UserControls" xmlns:utils="clr-namespace:_29WxOrderWpf.Utils" xmlns:wpf="WPFCommon" + d:DataContext="{d:DesignInstance Type=local:OrderListCtrl}" d:DesignHeight="450" d:DesignWidth="1560" Loaded="Window_Loaded" diff --git a/29WxOrderWpf/Ctrls/Settings/SettingsView.xaml b/29WxOrderWpf/Ctrls/Settings/SettingsView.xaml new file mode 100644 index 0000000..f39d44c --- /dev/null +++ b/29WxOrderWpf/Ctrls/Settings/SettingsView.xaml @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/29WxOrderWpf/Ctrls/Settings/SettingsView.xaml.cs b/29WxOrderWpf/Ctrls/Settings/SettingsView.xaml.cs new file mode 100644 index 0000000..df5200a --- /dev/null +++ b/29WxOrderWpf/Ctrls/Settings/SettingsView.xaml.cs @@ -0,0 +1,57 @@ +using _29WxOrderWpf.ViewModels; +using AllBase; +using AllBase.Model.Config; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using Work.BaseForms; + +namespace _29WxOrderWpf.Ctrls.Settings; + +/// +/// SettingsView.xaml 的交互逻辑 +/// +public partial class SettingsView : Window +{ + private SettingViewModel vm; + public SettingsView() + { + InitializeComponent(); + vm = new SettingViewModel(); + this.DataContext = vm; + this.Loaded += SettingsView_Loaded; + this.Closed += SettingsView_Closed; + } + private void SettingsView_Loaded(object sender, RoutedEventArgs e) + { + var setting = NaiBa.Util.Helper.ConfigHelper.LoadConfig(SettingViewModel.SettingFileName); + if (setting == null) setting = new SettingConfig(); + vm.Assign(setting); + } + private void SettingsView_Closed(object sender, EventArgs e) + { + try + { + var setting = vm.ToConfig(); + BaseClass.Setting = setting; + NaiBa.Util.Helper.ConfigHelper.SaveConfig(SettingViewModel.SettingFileName, JsonConvert.SerializeObject(setting)); + } + catch (Exception ex) + { + BaseMsgForm.ShowError("配置保存错误"); + } + } + + +} diff --git a/29WxOrderWpf/MainWindow.xaml b/29WxOrderWpf/MainWindow.xaml index b3e51c2..d20b081 100644 --- a/29WxOrderWpf/MainWindow.xaml +++ b/29WxOrderWpf/MainWindow.xaml @@ -34,8 +34,9 @@ - - + + + + + + + - -