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 @@ - - + + + + + + + - -