| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- using Prism.Mvvm;
- using System;
- using System.Reflection;
- namespace TeamAAS.Models
- {
- [Serializable]
- public class SystemConfiguration : BindableBase
- {
- public SystemConfiguration()
- {
- try
- {
- var version = Assembly.GetEntryAssembly()?.GetName()?.Version?.ToString();
- if (string.IsNullOrEmpty(version))
- version = Assembly.GetExecutingAssembly()?.GetName()?.Version?.ToString();
- SoftwareVersion = version ?? "1.0.0.0";
- }
- catch
- {
- SoftwareVersion = "1.0.0.0";
- }
- Title = "Team Vision";
- Font = new FontSizeSettings();
- Theme = "Light"; // 默认亮色(白色)主题
- AccentColor = "#2D6CDF"; // 默认主色(HandyControl 蓝)
- }
- private string _softwareVersion;
- public string SoftwareVersion
- {
- get => _softwareVersion;
- set => SetProperty(ref _softwareVersion, value);
- }
- private string _title;
- public string Title
- {
- get => _title;
- set => SetProperty(ref _title, value);
- }
- private string _companyTitle;
- public string CompanyTitle
- {
- get => _companyTitle;
- set => SetProperty(ref _companyTitle, value);
- }
-
- private FontSizeSettings _font;
- public FontSizeSettings Font
- {
- get => _font;
- set => SetProperty(ref _font, value);
- }
- private string _theme = "Light";
- /// <summary>主题:"Light"(默认)/ "Dark"</summary>
- public string Theme
- {
- get => _theme;
- set => SetProperty(ref _theme, string.IsNullOrWhiteSpace(value) ? "Light" : value);
- }
- private string _accentColor = "#2D6CDF";
- /// <summary>主色(十六进制 #RRGGBB)</summary>
- public string AccentColor
- {
- get => _accentColor;
- set => SetProperty(ref _accentColor, string.IsNullOrWhiteSpace(value) ? "#2D6CDF" : value);
- }
- private string _language = "zh-CN";
- /// <summary>界面语言:"zh-CN"(简体中文,默认)/ "en-US"(英语)/ "ja-JP"(日语)/ "ko-KR"(韩语)</summary>
- public string Language
- {
- get => _language;
- set => SetProperty(ref _language, string.IsNullOrWhiteSpace(value) ? "zh-CN" : value);
- }
- private VisionSettings _vision = new VisionSettings();
- /// <summary>视觉引擎与主页画面配置</summary>
- public VisionSettings Vision
- {
- get => _vision;
- set => SetProperty(ref _vision, value);
- }
- private TeamAAS.Logging.PluginLogConfig _pluginLog = new TeamAAS.Logging.PluginLogConfig();
- /// <summary>任务插件日志配置(等级默认值/日志根目录/路径命名公式),统一在此管理</summary>
- public TeamAAS.Logging.PluginLogConfig PluginLog
- {
- get => _pluginLog;
- set => SetProperty(ref _pluginLog, value);
- }
- }
- /// <summary>
- /// 视觉引擎与主页画面配置。
- /// EngineName:当前视觉引擎(对应 IVisualEngine.EngineName,程序启动时反射探测到的实现之一);
- /// HomePageFrameCount:主页视觉框数量(1-9);
- /// HomeFrameArrange:框排列方式,1=水平最优行列,2=垂直最优行列;
- /// FrameNames:各视觉框的用户可见名称,用“;”分隔,按序对应视觉框。
- /// </summary>
- [Serializable]
- public class VisionSettings : BindableBase
- {
- private string _engineName = "";
- public string EngineName
- {
- get => _engineName;
- set => SetProperty(ref _engineName, value);
- }
- private int _homePageFrameCount = 1;
- /// <summary>主页视觉框数量(1-9)</summary>
- public int HomePageFrameCount
- {
- get => _homePageFrameCount;
- set => SetProperty(ref _homePageFrameCount, Math.Max(1, Math.Min(9, value)));
- }
- private int _homeFrameArrange = 1;
- /// <summary>主页框排列方式:1=水平最优行列,2=垂直最优行列</summary>
- public int HomeFrameArrange
- {
- get => _homeFrameArrange;
- set => SetProperty(ref _homeFrameArrange, value == 2 ? 2 : 1);
- }
- private string _frameNames = "主画面";
- public string FrameNames
- {
- get => _frameNames;
- set => SetProperty(ref _frameNames, value ?? "");
- }
- /// <summary>取第 index 个画面的显示名称(配置缺失时自动补“画面N”)</summary>
- public string GetFrameName(int index)
- {
- var names = (_frameNames ?? "").Split(new[] { ';', ';' }, StringSplitOptions.RemoveEmptyEntries);
- if (index >= 0 && index < names.Length) return names[index].Trim();
- return $"画面{index + 1}";
- }
- }
- [Serializable]
- public class FontSizeSettings : BindableBase
- {
- private double _topBarHeight = 96;
- public double TopBarHeight
- {
- get => _topBarHeight;
- set => SetProperty(ref _topBarHeight, value);
- }
- private double _centerTitleFont = 48;
- public double CenterTitleFont
- {
- get => _centerTitleFont;
- set => SetProperty(ref _centerTitleFont, value);
- }
- private double _statusBarHeight = 38;
- public double StatusBarHeight
- {
- get => _statusBarHeight;
- set => SetProperty(ref _statusBarHeight, value);
- }
- private double _statusBarFont = 16;
- public double StatusBarFont
- {
- get => _statusBarFont;
- set => SetProperty(ref _statusBarFont, value);
- }
- private double _navButtonWidth = 88;
- public double NavButtonWidth
- {
- get => _navButtonWidth;
- set => SetProperty(ref _navButtonWidth, value);
- }
- private double _navButtonHeight = 80;
- public double NavButtonHeight
- {
- get => _navButtonHeight;
- set => SetProperty(ref _navButtonHeight, value);
- }
- private double _navButtonFont = 23;
- public double NavButtonFont
- {
- get => _navButtonFont;
- set => SetProperty(ref _navButtonFont, value);
- }
- private double _themeIconSize = 33;
- public double ThemeIconSize
- {
- get => _themeIconSize;
- set => SetProperty(ref _themeIconSize, value);
- }
- private double _navIconSize = 38;
- public double NavIconSize
- {
- get => _navIconSize;
- set => SetProperty(ref _navIconSize, value);
- }
- }
- }
|