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.Core/Setting/SystemSetting.cs | 134 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 134 insertions(+), 0 deletions(-)
diff --git a/HMI.Core/Setting/SystemSetting.cs b/HMI.Core/Setting/SystemSetting.cs
new file mode 100644
index 0000000..e07e053
--- /dev/null
+++ b/HMI.Core/Setting/SystemSetting.cs
@@ -0,0 +1,134 @@
+锘縰sing System;
+using System.IO;
+using HMI.Core.Entity;
+using HMI.Core.Util;
+
+namespace HMI.Core.Setting
+{
+ public class SystemSetting
+ {
+ public static SystemSetting Instance { get; private set; }
+ /// <summary>
+ /// 绯荤粺璁剧疆鏀瑰彉浜嬩欢
+ /// </summary>
+ public static event EventHandler<SystemSetting> SystemSettingChanged;
+
+ private static string FilePath = Path.Combine(PathHelper.SettingFolder, "SystemConfig.xml");
+
+ static SystemSetting()
+ {
+ LoadFromXml();
+ }
+
+ private SystemSetting()
+ {
+
+ }
+
+ public string LogoPath { get; private set; } = ".\\Logo.png";
+ public string LoginLogoPath { get; private set; } = ".\\LoginLogo.png";
+ public string WindowTitle { get; private set; } = "浜у搧娴嬭瘯骞冲彴";
+ public string PlcIp { get; private set; } = "127.0.0.1";
+ public int PlcPort { get; private set; } = 102;
+ public bool PlcEnabled { get; private set; }
+ public string CurrentLanguage { get; private set; } = "zh-CN";
+ public int LogExpiredDays { get; private set; } = 7;
+
+ private static void LoadFromXml()
+ {
+ if (Instance != null) return;
+ if (!File.Exists(FilePath))
+ {
+ Instance = new SystemSetting();
+ }
+ else
+ {
+ SystemSettingModel model = XmlHelper.DeserializeFromXml<SystemSettingModel>(FilePath);
+ SystemSetting setting = new SystemSetting();
+ BeanUtil.Copy(model, setting);
+ Instance = setting;
+ }
+ }
+
+ public static SystemSettingModel GetModel()
+ {
+ return XmlHelper.DeserializeFromXml<SystemSettingModel>(FilePath);
+ }
+
+ public static void ReLoad()
+ {
+ if (!File.Exists(FilePath))
+ {
+ return;
+ }
+ else
+ {
+ SystemSettingModel model = XmlHelper.DeserializeFromXml<SystemSettingModel>(FilePath);
+ SystemSetting setting = new SystemSetting();
+ BeanUtil.Copy(model, setting);
+ Instance = setting;
+ }
+ SystemSettingChanged?.Invoke(null, Instance);
+ }
+ }
+
+
+ public class SystemSettingModel : NotifyBase
+ {
+ private string logoPath;
+ public string LogoPath
+ {
+ get => logoPath;
+ set { Set(ref logoPath, value); }
+ }
+
+ private string loginLogoPath;
+ public string LoginLogoPath
+ {
+ get => loginLogoPath;
+ set { Set(ref loginLogoPath, value); }
+ }
+
+ private string windowTitle;
+ public string WindowTitle
+ {
+ get => windowTitle;
+ set { Set(ref windowTitle, value); }
+ }
+
+ private string plcIp;
+ public string PlcIp
+ {
+ get => plcIp;
+ set { Set(ref plcIp, value); }
+ }
+
+ private int plcPort;
+ public int PlcPort
+ {
+ get => plcPort;
+ set { Set(ref plcPort, value); }
+ }
+
+ private bool plcEnabled;
+ public bool PlcEnabled
+ {
+ get => plcEnabled;
+ set { Set(ref plcEnabled, value); }
+ }
+
+ private string currentLanguage;
+ public string CurrentLanguage
+ {
+ get => currentLanguage;
+ set { Set(ref currentLanguage, value); }
+ }
+
+ private int logExpiredDays;
+ public int LogExpiredDays
+ {
+ get => logExpiredDays;
+ set { Set(ref logExpiredDays, value); }
+ }
+ }
+}
--
Gitblit v1.9.1