patrick
2019-12-10 1c4426810c71eead57084be8a18ade8d314dd8c4
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
using Bro.Common.Helper;
using Newtonsoft.Json;
using System;
using System.ComponentModel;
 
namespace Bro.Common.Model
{
    public class IODefinition : IComplexDisplay
    {
        [Category("IO配置")]
        [Description("IO索引,从0开始")]
        public int IOIndex { get; set; }
 
        [Category("IO配置")]
        [Description("IO描述")]
        public string IODesc { get; set; } = "";
 
        [Category("IO配置")]
        [Description("true:接通触发  false:断开触发")]
        public bool TriggerValue { get; set; } = true;
 
        [Browsable(false)]
        [JsonIgnore]
        public bool CurrentValue { get; set; } = true;
 
        [Category("IO配置")]
        [Description("IO定义类型")]
        public IODefinitionType IOType { get; set; } = IODefinitionType.Warning;
 
        public string GetDisplayText()
        {
            return $"{IOIndex}{(string.IsNullOrWhiteSpace(IODesc) ? "" : (":" + IODesc))}:{IOType.ToString()}";
        }
    }
 
    public enum IODefinitionType
    {
        Start,
        Stop,
        Reset,
        Warning,
    }
}