alielie
2025-03-03 1fca2167068e9ef2c079ec742f20313fc6697ab1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Windows.Controls;
using HMI.Core.Setting;
using HMI.Core.Util;
using HMI.UI.Util;
 
namespace HMI.SettingControl
{
    /// <summary>
    /// SystemConfig.xaml 的交互逻辑
    /// </summary>
    public partial class SystemConfig : UserControl
    {
        public SystemConfig()
        {
            var model = new SystemSettingModel();
            BeanUtil.Copy(SystemSetting.Instance, model);
            DataContext = model;
            InitializeComponent();
        }
 
        private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            try
            {
                SystemSettingModel settingModel = (SystemSettingModel)DataContext;
                XmlHelper.SerializeToXml(PathHelper.ConfigFolder + "\\SystemConfig.xml", settingModel);
                SystemSetting.ReLoad();
                this.Success("保存成功");
            }
            catch (Exception ex)
            {
                this.Error($"保存失败!{ex.Message}");
            }
        }
    }
}