From 21e28b068c8d0763a6d4ab613388a77a0db157fb Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期一, 03 三月 2025 19:01:30 +0800
Subject: [PATCH] 优化结构;

---
 HMI.SettingControl/SystemConfig.xaml.cs |   34 ++++++++++++++++++++++++++++++----
 1 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/HMI.SettingControl/SystemConfig.xaml.cs b/HMI.SettingControl/SystemConfig.xaml.cs
index cb7ec96..53e5e26 100644
--- a/HMI.SettingControl/SystemConfig.xaml.cs
+++ b/HMI.SettingControl/SystemConfig.xaml.cs
@@ -1,13 +1,16 @@
-锘縰sing System.Windows.Controls;
+锘縰sing System;
+using System.Windows.Controls;
+using HMI.Core.Api;
 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 partial class SystemConfig : UserControl, IConfigManager
     {
         public SystemConfig()
         {
@@ -17,11 +20,34 @@
             InitializeComponent();
         }
 
-        private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
+        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);
+            XmlHelper.SerializeToXml(PathHelper.ConfigFolder + "\\SystemConfig.xml", settingModel);
             SystemSetting.ReLoad();
         }
+
+        private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            try
+            {
+            }
+            catch (Exception ex)
+            {
+                this.Error($"淇濆瓨澶辫触锛亄ex.Message}");
+            }
+        }
     }
 }

--
Gitblit v1.9.1