| | |
| | | using System.Linq; |
| | | using System.Windows.Forms; |
| | | using System.Windows.Forms.Design; |
| | | using static Bro.Common.Helper.EnumHelper; |
| | | |
| | | namespace Bro.Common.Model |
| | | { |
| | | public class SimpleMonitorSet : IMonitorSet, IComplexDisplay |
| | | public class MonitorSetBase : IMonitorSet, IComplexDisplay |
| | | { |
| | | [Browsable(false)] |
| | | public string Id { get; set; } = Guid.NewGuid().ToString(); |
| | |
| | | public string Name { get; set; } = ""; |
| | | |
| | | [Browsable(false)] |
| | | [JsonIgnore] |
| | | public ProcessResponse Response { get; set; } = new ProcessResponse(); |
| | | |
| | | [Browsable(false)] |
| | | public string DisplayText |
| | | { |
| | | get |
| | |
| | | } |
| | | } |
| | | |
| | | public SimpleMonitorSet() { } |
| | | public MonitorSetBase() { } |
| | | |
| | | public virtual string GetDisplayText() |
| | | { |
| | |
| | | /// <summary> |
| | | /// PLC监听设置 |
| | | /// </summary> |
| | | public class MonitorSet : SimpleMonitorSet |
| | | public class PLCMonitorSet : MonitorSetBase |
| | | { |
| | | /// <summary> |
| | | /// 监听地址索引 按照PLC监听地址从0开始的索引 |
| | | /// 监听地址索引 按照监听地址从0开始的索引 |
| | | /// </summary> |
| | | [Category("监听设置")] |
| | | [Description("监听地址索引 按照PLC监听地址从0开始的索引")] |
| | | [Description("监听地址索引 按照监听地址从0开始的索引")] |
| | | [DisplayName("触发索引")] |
| | | public int TriggerIndex { get; set; } = -1; |
| | | |
| | |
| | | public int TriggerValue { get; set; } = -1; |
| | | |
| | | /// <summary> |
| | | /// 传入数据地址的索引 按照PLC监听地址从0开始的索引集合 |
| | | /// 传入数据地址的索引 按照监听地址从0开始的索引集合 |
| | | /// </summary> |
| | | [Category("监听设置")] |
| | | [Description("传入数据地址的索引 按照PLC监听地址从0开始的索引")] |
| | | [Description("传入数据地址的索引 按照监听地址从0开始的索引")] |
| | | [DisplayName("传入数据索引")] |
| | | [TypeConverter(typeof(SimpleCollectionConvert<int>))] |
| | | public List<int> InputDataIndex { get; set; } = new List<int>(); |
| | | |
| | | /// <summary> |
| | | /// 数据地址 实际PLC寄存器的地址,例如 40012 |
| | | /// 数据地址 实际寄存器的地址,例如 40012 |
| | | /// </summary> |
| | | [Category("回传设置")] |
| | | [Description("回传数据地址 实际PLC寄存器的地址,10进制,例如 40012")] |
| | |
| | | public int ReplyDataAddress { get; set; } = -1; |
| | | |
| | | /// <summary> |
| | | /// 通知地址 实际PLC寄存器的地址,例如 40012 |
| | | /// 通知地址 实际寄存器的地址,例如 40012 |
| | | /// </summary> |
| | | [Category("回传设置")] |
| | | [Description("通知地址 实际PLC寄存器的地址,10进制,例如 40012")] |
| | | [Description("通知地址 实际寄存器的地址,10进制,例如 40012")] |
| | | [DisplayName("通知地址")] |
| | | public int NoticeAddress { get; set; } = -1; |
| | | |
| | | [Browsable(false)] |
| | | [JsonIgnore] |
| | | public ProcessResponse Response { get; set; } = new ProcessResponse(); |
| | | |
| | | public MonitorSet() { } |
| | | public PLCMonitorSet() { } |
| | | |
| | | public override string GetDisplayText() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 运动板卡IO监听配置对象 |
| | | /// </summary> |
| | | public class MotionCardMonitorSet : MonitorSetBase |
| | | { |
| | | /// <summary> |
| | | /// 监听类型 |
| | | /// </summary> |
| | | [Category("监听设置")] |
| | | [DisplayName("监听类型")] |
| | | [Description("监听运动板卡 IO 类型(IN OUT)")] |
| | | public IOType MonitorIOModel { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 监听地址索引 |
| | | /// </summary> |
| | | [Category("监听设置")] |
| | | [Description("监听地址索引")] |
| | | [DisplayName("触发索引")] |
| | | public int TriggerIndex { get; set; } = -1; |
| | | |
| | | /// <summary> |
| | | /// 触发值 |
| | | /// </summary> |
| | | [Category("监听设置")] |
| | | [Description("触发值,设置为-999时变化即触发")] |
| | | [DisplayName("触发值")] |
| | | public int TriggerValue { get; set; } = -1; |
| | | |
| | | /// <summary> |
| | | /// 监听回传 |
| | | /// </summary> |
| | | [Category("回传设置")] |
| | | [DisplayName("监听回传")] |
| | | [Description("监听运动板卡,并往指定的IO写入数据")] |
| | | [TypeConverter(typeof(CollectionCountConvert))] |
| | | [Editor(typeof(IOItem), typeof(UITypeEditor))] |
| | | public List<IOItem> ReplyIODatas { get; set; } = new List<IOItem>(); |
| | | } |
| | | |
| | | public class IOperationConfigEditor : UITypeEditor |
| | | { |
| | | public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context) |