using HMI.Core.Entity; using HMI.Core.Manager; using System; using System.Collections; using System.Configuration; using System.Runtime.CompilerServices; namespace Plugin.TestResult_WPF.Model { public class BaseConfig { private static Hashtable customConfig = (Hashtable)ConfigurationManager.GetSection("TestResultConfig"); private string GetValue([CallerMemberName] string propertyName = null) { return (customConfig != null && customConfig.ContainsKey(propertyName)) ? customConfig[propertyName].ToString() : null; } /// /// 首页布局行数 /// private int row = 1; public int Row { get { var data = GetValue(); return data == null ? row : int.Parse(data); } set { customConfig[nameof(Row)] = value; } } /// /// 首页布局列数 /// private int column = 2; public int Column { get { var data = GetValue(); return data == null ? column : int.Parse(data); } set { customConfig[nameof(Column)] = value; } } /// /// 炉数 -1 就是row*column /// private int cellCount = -1; public int CellCount { get { var data = GetValue(); return data == null ? cellCount : int.Parse(data); } set { customConfig[nameof(CellCount)] = value; } } /// /// 点位列数 /// private int positionColumn = 6; public int PositionColumn { get { var data = GetValue(); return data == null ? positionColumn : int.Parse(data); } set { customConfig[nameof(PositionColumn)] = value; } } /// /// 每个炉子的点位数 /// private int positionCount = 54; public int PositionCount { get { var data = GetValue(); return data == null ? positionCount : int.Parse(data); } set { customConfig[nameof(PositionCount)] = value; } } /// /// 曲线最多保存多少数据 /// private int maxSize = 10000; public int MaxSize { get { var data = GetValue(); return data == null ? maxSize : int.Parse(data); } set { customConfig[nameof(MaxSize)] = value; } } /// /// 图表刷新频率 ms /// private int refreshInterval = 500; public int RefreshInterval { get { var data = GetValue(); return data == null ? refreshInterval : int.Parse(data); } set { customConfig[nameof(RefreshInterval)] = value; } } /// /// 炉子名称 /// private string nameStr = "A,B,C,D,E,F,G"; public string NameStr { get { var data = GetValue(); return data == null ? nameStr : data; } set { customConfig[nameof(NameStr)] = value; } } /// /// 穴位Step列表最大容量 /// private int cellListMaxSize = 10000; public int CellListMaxSize { get { var data = GetValue(); return data == null ? cellListMaxSize : int.Parse(data); } set { customConfig[nameof(CellListMaxSize)] = value; } } private int portStart = 6660; public int PortStart { get { var data = GetValue(); return data == null ? portStart : int.Parse(data); } set { customConfig[nameof(PortStart)] = value; } } private string codeParserType; public string CodeParserType { get { var data = GetValue(); return data == null ? codeParserType : data.ToString(); } } public bool testing = false; } }