wenxiangchao
2026-11-02 fe2aa4880d5c9fd88088ad0ed81ebaca05629f5f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
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;
        }
 
        /// <summary>
        /// 首页布局行数
        /// </summary>
        private int row = 1;
        public int Row
        {
            get
            {
                var data = GetValue();
                return data == null ? row : int.Parse(data);
            }
            set
            {
                customConfig[nameof(Row)] = value;
            }
        }
 
        /// <summary>
        /// 首页布局列数
        /// </summary>
        private int column = 2;
        public int Column
        {
            get
            {
                var data = GetValue();
                return data == null ? column : int.Parse(data);
            }
            set
            {
                customConfig[nameof(Column)] = value;
            }
        }
 
        /// <summary>
        /// 炉数 -1 就是row*column
        /// </summary>
        private int cellCount = -1;
        public int CellCount
        {
            get
            {
                var data = GetValue();
                return data == null ? cellCount : int.Parse(data);
            }
            set
            {
                customConfig[nameof(CellCount)] = value;
            }
        }
 
        /// <summary>
        /// 点位列数
        /// </summary>
        private int positionColumn = 6;
        public int PositionColumn
        {
            get
            {
                var data = GetValue();
                return data == null ? positionColumn : int.Parse(data);
            }
            set
            {
                customConfig[nameof(PositionColumn)] = value;
            }
        }
 
        /// <summary>
        /// 每个炉子的点位数
        /// </summary>
        private int positionCount = 54;
        public int PositionCount
        {
            get
            {
                var data = GetValue();
                return data == null ? positionCount : int.Parse(data);
            }
            set
            {
                customConfig[nameof(PositionCount)] = value;
            }
        }
 
        /// <summary>
        /// 曲线最多保存多少数据
        /// </summary>
        private int maxSize = 10000;
        public int MaxSize
        {
            get
            {
                var data = GetValue();
                return data == null ? maxSize : int.Parse(data);
            }
            set
            {
                customConfig[nameof(MaxSize)] = value;
            }
        }
 
        /// <summary>
        /// 图表刷新频率 ms
        /// </summary>
        private int refreshInterval = 500;
        public int RefreshInterval
        {
            get
            {
                var data = GetValue();
                return data == null ? refreshInterval : int.Parse(data);
            }
            set
            {
                customConfig[nameof(RefreshInterval)] = value;
            }
        }
 
        /// <summary>
        /// 炉子名称
        /// </summary>
        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;
            }
        }
 
        /// <summary>
        /// 穴位Step列表最大容量
        /// </summary>
        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;
    }
}