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
|
{
|
/// <summary>
|
/// 输入参数
|
/// </summary>
|
[JsonIgnore]
|
[Category("输入配置")]
|
[Description("输入参数配置")]
|
[TypeConverter(typeof(SimpleCollectionConvert<int>))]
|
public List<int> InputPara { get; set; } = new List<int>();
|
|
/// <summary>
|
/// 异常反馈值
|
/// </summary>
|
[Category("异常反馈设置")]
|
[Description("异常反馈值")]
|
public int ExceptionValue { get; set; } = 0;
|
|
/// <summary>
|
/// 发生异常时的重新尝试次数
|
/// </summary>
|
[Category("异常反馈设置")]
|
[Description("发生异常时的重新尝试次数")]
|
public int ReTryTimes { get; set; } = 3;
|
}
|
|
public abstract class InitialConfigBase : IInitialConfig
|
{
|
[Category("通用配置")]
|
[Description("设备索引")]
|
[ReadOnly(true)]
|
public string Id { get; set; } = Guid.NewGuid().ToString().ToUpper();
|
|
[Category("通用配置")]
|
[Description("设备名称")]
|
public string Name { get; set; } = "UnNamed";
|
|
/// <summary>
|
/// 设备是否启用
|
/// </summary>
|
[Category("通用配置")]
|
[Description("设备是否启用")]
|
public bool IsEnabled { get; set; } = false;
|
|
/// <summary>
|
/// 设备类型 在具体设备基类中看是否需要开放重写
|
/// </summary>
|
[Browsable(false)]
|
public virtual string DriverType { get; set; } = "";
|
|
[Category("日志配置")]
|
[Description("日志记录目录")]
|
[Editor(typeof(FoldDialogEditor), typeof(UITypeEditor))]
|
public string LogPath { get; set; } = "";
|
|
[Category("日志配置")]
|
[Description("true:启用日志记录 false:不启用日志记录")]
|
public bool IsEnableLog { get; set; } = false;
|
|
public virtual List<string> GetHalconToolPathList()
|
{
|
return new List<string>();
|
}
|
|
public InitialConfigBase()
|
{
|
var attr = this.GetType().GetCustomAttribute<DeviceAttribute>();
|
if (attr != null)
|
{
|
this.DriverType = attr.TypeCode;
|
}
|
}
|
}
|
}
|