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, } }