增加设置页面
增加礼物发货 超出6元 则发礼物二
This commit is contained in:
1 parent
d18460c83f
commit
5003ea93f8
11 files changed
+642
-46
No files matched your search
@@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// SettingsView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
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<SettingConfig>(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("配置保存错误");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user