From 9d1660270272180cd71147d6ddd53d1382643d2e Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 02 十一月 2026 18:00:14 +0800
Subject: [PATCH] merge: 并入远程 Initial commit 作为历史根节点

---
 HMI.SettingControl/SystemConfig.xaml.cs |  120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 120 insertions(+), 0 deletions(-)

diff --git a/HMI.SettingControl/SystemConfig.xaml.cs b/HMI.SettingControl/SystemConfig.xaml.cs
new file mode 100644
index 0000000..f9877f7
--- /dev/null
+++ b/HMI.SettingControl/SystemConfig.xaml.cs
@@ -0,0 +1,120 @@
+锘縰sing System;
+using System.IO;
+using System.Windows;
+using System.Windows.Controls;
+using HMI.Core.Api;
+using HMI.Core.Setting;
+using HMI.Core.Util;
+using HMI.UI.Util;
+using Microsoft.Win32;
+
+namespace HMI.SettingControl
+{
+    /// <summary>
+    /// SystemConfig.xaml 鐨勪氦浜掗�昏緫
+    /// </summary>
+    public partial class SystemConfig : UserControl, IFolderOwner, IConfigManager
+    {
+        private string BaseFolder;
+        private SystemSettingModel Model;
+        public SystemConfig()
+        {
+            InitializeComponent();
+        }
+
+        public object GetConfig()
+        {
+            return SystemSetting.Instance;
+        }
+
+        public void ResetConfig()
+        {
+            Model = new SystemSettingModel();
+            BeanUtil.Copy(SystemSetting.Instance, Model);
+            DataContext = Model;
+        }
+
+        public void SaveConfig()
+        {
+            SystemSettingModel settingModel = (SystemSettingModel)DataContext;
+            XmlHelper.SerializeToXml(Path.Combine(PathHelper.SettingFolder, "SystemConfig.xml"), settingModel);
+            SystemSetting.ReLoad();
+        }
+
+        public void SetBaseFolder(string folder)
+        {
+            this.BaseFolder = folder;
+        }
+
+        private void Button_Click(object sender, RoutedEventArgs e)
+        {
+            Button btn = sender as Button;
+            switch (btn.Name)
+            {
+                case "BtnIcon":
+                    OpenSelectIcon();
+                    break;
+                case "BtnLoginLogo":
+                    OpenSelectIcon2();
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        private void OpenSelectIcon()
+        {
+            string BasePath = PathHelper.IconFolder;
+
+            OpenFileDialog openFileDialog = new OpenFileDialog();
+            openFileDialog.Filter = "(*.*)|*.*";
+            openFileDialog.InitialDirectory = BasePath;
+            openFileDialog.Title = this.lang("App.SelectPic");
+            openFileDialog.Multiselect = false;
+
+            if (openFileDialog.ShowDialog() == true)
+            {
+                string FileName = openFileDialog.FileName;
+                if (!FileName.StartsWith(BasePath))
+                {
+                    ToastHelper.Warning(Window.GetWindow(this), this.lang("App.IconMustInFolder"));
+                }
+                else
+                {
+                    Model.LogoPath = FileName.Replace(BasePath, ".");
+                }
+            }
+        }
+
+        private void OpenSelectIcon2()
+        {
+            string BasePath = PathHelper.IconFolder;
+
+            OpenFileDialog openFileDialog = new OpenFileDialog();
+            openFileDialog.Filter = "(*.*)|*.*";
+            openFileDialog.InitialDirectory = BasePath;
+            openFileDialog.Title = this.lang("App.SelectPic");
+            openFileDialog.Multiselect = false;
+
+            if (openFileDialog.ShowDialog() == true)
+            {
+                string FileName = openFileDialog.FileName;
+                if (!FileName.StartsWith(BasePath))
+                {
+                    ToastHelper.Warning(Window.GetWindow(this), this.lang("App.IconMustInFolder"));
+                }
+                else
+                {
+                    Model.LoginLogoPath = FileName.Replace(BasePath, ".");
+                }
+            }
+        }
+
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            CbLang.ItemsSource = LangUtil.langs;
+            ResetConfig();
+            Loaded -= UserControl_Loaded;
+        }
+    }
+}

--
Gitblit v1.9.1