wenxiangchao
2026-11-02 fe2aa4880d5c9fd88088ad0ed81ebaca05629f5f
Plugin.TestResult/Model/BaseConfig.cs
@@ -1,4 +1,7 @@
using System.Collections;
using HMI.Core.Entity;
using HMI.Core.Manager;
using System;
using System.Collections;
using System.Configuration;
using System.Runtime.CompilerServices;
@@ -7,6 +10,12 @@
    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;
        }
        /// <summary>
        /// 首页布局行数
        /// </summary>
@@ -18,11 +27,10 @@
                var data = GetValue();
                return data == null ? row : int.Parse(data);
            }
        }
        private string GetValue([CallerMemberName] string propertyName = null)
        {
            return (customConfig != null && customConfig.ContainsKey(propertyName)) ? customConfig[propertyName].ToString() : null;
            set
            {
                customConfig[nameof(Row)] = value;
            }
        }
        /// <summary>
@@ -35,6 +43,10 @@
            {
                var data = GetValue();
                return data == null ? column : int.Parse(data);
            }
            set
            {
                customConfig[nameof(Column)] = value;
            }
        }
@@ -49,6 +61,10 @@
                var data = GetValue();
                return data == null ? cellCount : int.Parse(data);
            }
            set
            {
                customConfig[nameof(CellCount)] = value;
            }
        }
        /// <summary>
@@ -61,6 +77,10 @@
            {
                var data = GetValue();
                return data == null ? positionColumn : int.Parse(data);
            }
            set
            {
                customConfig[nameof(PositionColumn)] = value;
            }
        }
@@ -75,6 +95,10 @@
                var data = GetValue();
                return data == null ? positionCount : int.Parse(data);
            }
            set
            {
                customConfig[nameof(PositionCount)] = value;
            }
        }
        /// <summary>
@@ -87,6 +111,10 @@
            {
                var data = GetValue();
                return data == null ? maxSize : int.Parse(data);
            }
            set
            {
                customConfig[nameof(MaxSize)] = value;
            }
        }
@@ -101,6 +129,10 @@
                var data = GetValue();
                return data == null ? refreshInterval : int.Parse(data);
            }
            set
            {
                customConfig[nameof(RefreshInterval)] = value;
            }
        }
        /// <summary>
@@ -114,31 +146,9 @@
                var data = GetValue();
                return data == null ? nameStr : data;
            }
        }
        /// <summary>
        /// 默认展示的图表标题
        /// </summary>
        private string mainChartTitle = "平均温度";
        public string MainChartTitle
        {
            get
            set
            {
                var data = GetValue();
                return data == null ? mainChartTitle : data;
            }
        }
        /// <summary>
        /// 双击打开的详细图表标题
        /// </summary>
        private string detailChartTitle = "详细温度";
        public string DetailChartTitle
        {
            get
            {
                var data = GetValue();
                return data == null ? detailChartTitle : data;
                customConfig[nameof(NameStr)] = value;
            }
        }
@@ -153,6 +163,10 @@
                var data = GetValue();
                return data == null ? cellListMaxSize : int.Parse(data);
            }
            set
            {
                customConfig[nameof(CellListMaxSize)] = value;
            }
        }
        private int portStart = 6660;
@@ -163,6 +177,20 @@
                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;