alielie
2025-03-04 2b1a6417285597bc58ef28aa3f01aeee2532cd19
HMI.SettingControl/SystemConfig.xaml.cs
@@ -1,5 +1,6 @@
using System;
using System.Windows.Controls;
using HMI.Core.Api;
using HMI.Core.Setting;
using HMI.Core.Util;
using HMI.UI.Util;
@@ -9,7 +10,7 @@
    /// <summary>
    /// SystemConfig.xaml 的交互逻辑
    /// </summary>
    public partial class SystemConfig : UserControl
    public partial class SystemConfig : UserControl, IConfigManager
    {
        public SystemConfig()
        {
@@ -19,14 +20,29 @@
            InitializeComponent();
        }
        public object GetConfig()
        {
            return SystemSetting.Instance;
        }
        public void ResetConfig()
        {
            var model = new SystemSettingModel();
            BeanUtil.Copy(SystemSetting.Instance, model);
            DataContext = model;
        }
        public void SaveConfig()
        {
            SystemSettingModel settingModel = (SystemSettingModel)DataContext;
            XmlHelper.SerializeToXml(PathHelper.ConfigFolder + "\\SystemConfig.xml", settingModel);
            SystemSetting.ReLoad();
        }
        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)
            {