using Bro.Common.Helper; using Bro.Common.Interface; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing.Design; using System.Reflection; namespace Bro.Common.Base { public class OperationConfigBase : IOperationConfig { /// /// 输入参数 /// [JsonIgnore] [Category("输入配置")] [Description("输入参数配置")] [DisplayName("输入参数")] [TypeConverter(typeof(SimpleCollectionConvert))] public List InputPara { get; set; } = new List(); /// /// 异常反馈值 /// [Category("异常反馈设置")] [Description("异常反馈值")] [DisplayName("异常反馈值")] public int ExceptionValue { get; set; } = 0; /// /// 发生异常时的重新尝试次数 /// [Category("异常反馈设置")] [Description("发生异常时的重新尝试次数")] [DisplayName("重试次数")] public int ReTryTimes { get; set; } = 3; [Browsable(false)] public string MonitorSetId { get; set; } = ""; } public class InitialConfigBase : IInitialConfig { [Category("通用配置")] [Description("设备索引")] [ReadOnly(true)] public string Id { get; set; } = Guid.NewGuid().ToString().ToUpper(); [Category("通用配置")] [Description("设备名称")] [DisplayName("设备名称")] public string Name { get; set; } = "UnNamed"; /// /// 设备是否启用 /// [Category("通用配置")] [Description("设备是否启用")] [DisplayName("启用状态")] public bool IsEnabled { get; set; } = false; private string driverType = ""; /// /// 设备类型 /// [Category("驱动类型")] [Description("设备驱动类型")] [TypeConverter(typeof(DeviceTypeConverter))] public virtual string DriverType { get { if (string.IsNullOrWhiteSpace(driverType)) { var attr = GetType().GetCustomAttribute(); if (attr != null) { driverType = attr.TypeCode; } } return driverType; } set => driverType = value; } [Category("日志配置")] [Description("日志记录目录")] [DisplayName("日志目录")] [Editor(typeof(FoldDialogEditor), typeof(UITypeEditor))] public string LogPath { get; set; } = ""; [Category("日志配置")] [Description("true:启用日志记录 false:不启用日志记录")] [DisplayName("日志状态")] public bool IsEnableLog { get; set; } = false; public virtual List GetHalconToolPathList() { return new List(); } //public InitialConfigBase() //{ // var attr = this.GetType().GetCustomAttribute(); // if (attr != null) // { // this.DriverType = attr.TypeCode; // } //} } }