| | |
| | | /// IO点的值 |
| | | /// </summary> |
| | | [Category("IO配置")] |
| | | [Description("IO数值")] |
| | | public virtual int Value { get; set; } |
| | | [Description("IO状态")] |
| | | [TypeConverter(typeof(EnumDescriptionConverter<IOValue>))] |
| | | public virtual IOValue Value { get; set; } |
| | | |
| | | /// <summary> |
| | | /// IO点是in还是out |
| | |
| | | return false; |
| | | } |
| | | |
| | | public string GetDisplayText() |
| | | public virtual string GetDisplayText() |
| | | { |
| | | return $"{IOType.GetEnumDescription()}-{IONum}-{Value}"; |
| | | return $"{IOType.GetEnumDescription()}-{IONum}-{Value.GetEnumDescription()}"; |
| | | } |
| | | |
| | | public int GetHashCode(object obj) |
| | |
| | | public class IODefinition : IOItem |
| | | { |
| | | [Category("IO配置")] |
| | | [Description("IO预定义")] |
| | | [TypeConverter(typeof(EnumDescriptionConverter<IOPrestatement>))] |
| | | public IOPrestatement IOPreStatement { get; set; } = IOPrestatement.Customized; |
| | | |
| | | [Category("IO配置")] |
| | | [Description("IO用途描述")] |
| | | public string IODesc { get; set; } |
| | | |
| | |
| | | |
| | | [Browsable(false)] |
| | | [JsonIgnore] |
| | | public override int Value { get; set; } |
| | | public override IOValue Value { get; set; } |
| | | |
| | | public new string GetDisplayText() |
| | | public override string GetDisplayText() |
| | | { |
| | | return $"{IODesc} {IOType.GetEnumDescription()} {IONum}"; |
| | | return $"{(IOPreStatement == IOPrestatement.Customized ? IODesc : IOPreStatement.GetEnumDescription())} {IOType.GetEnumDescription()} {IONum}"; |
| | | } |
| | | } |
| | | |
| | |
| | | public IODefinition IOItem { get; set; } = new IODefinition(); |
| | | |
| | | [Category("IO操作配置")] |
| | | [Description("需要操作的IO的数值")] |
| | | public int CheckValue |
| | | [Description("需要操作的IO的状态")] |
| | | public IOValue CheckValue |
| | | { |
| | | get => IOItem.Value; |
| | | set => IOItem.Value = value; |
| | |
| | | |
| | | public string GetDisplayText() |
| | | { |
| | | return IOItem.IODesc + "-" + CheckValue; |
| | | return IOItem.IODesc + "-" + CheckValue.GetEnumDescription(); |
| | | } |
| | | } |
| | | |