| | |
| | | using Bro.Common.Helper; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using static Bro.Common.Helper.EnumHelper; |
| | |
| | | { |
| | | [Category("IO操作配置")] |
| | | [Description("需要操作的IO")] |
| | | [TypeConverter(typeof(IORefrenceItemSourceConverter))] |
| | | public IOItem IOItem { get; set; } = new IOItem(); |
| | | |
| | | [Category("IO操作配置")] |
| | |
| | | [JsonIgnore] |
| | | public List<IODefinition> IOItemSource { get; set; } = new List<IODefinition>(); |
| | | } |
| | | |
| | | public class IORefrenceItemSourceConverter : ComboBoxItemTypeConvert |
| | | { |
| | | public override Hashtable GetConvertHash(ITypeDescriptorContext context) |
| | | { |
| | | Hashtable table = new Hashtable(); |
| | | |
| | | if (context.Instance is IORefrenceItem item) |
| | | { |
| | | item.IOItemSource.ForEach(i => |
| | | { |
| | | table[i.IODesc + i.IOType.GetEnumDescription() + i.IONum] = i as IOItem; |
| | | }); |
| | | } |
| | | |
| | | return table; |
| | | } |
| | | } |
| | | } |