using Bro.Common.Base;
|
using Bro.Common.Helper;
|
using Bro.Common.Interface;
|
using Bro.Common.Model;
|
using System.Collections;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Drawing.Design;
|
using System.Linq;
|
|
namespace Bro.Process
|
{
|
[Process("", EnumHelper.DeviceAttributeType.InitialConfig)]
|
public class ProcessConfigBase : IProcessConfig
|
{
|
#region 设备配置
|
[Category("设备配置")]
|
[Description("相机配置")]
|
[DisplayName("相机配置")]
|
[TypeConverter(typeof(CollectionCountConvert))]
|
[Editor(typeof(InitialConfigCollectionEditor<CameraInitialConfigBase>), typeof(UITypeEditor))]
|
public List<IInitialConfig> CameraConfigCollection { get; set; } = new List<IInitialConfig>();
|
|
[Category("设备配置")]
|
[Description("PLC配置")]
|
[DisplayName("PLC配置")]
|
[TypeConverter(typeof(CollectionCountConvert))]
|
[Editor(typeof(InitialConfigCollectionEditor<PLCInitialConfigBase>), typeof(UITypeEditor))]
|
public List<IInitialConfig> PLCConfigCollection { get; set; } = new List<IInitialConfig>();
|
|
[Category("设备配置")]
|
[Description("其他设备配置")]
|
[DisplayName("其他设备配置")]
|
[TypeConverter(typeof(CollectionCountConvert))]
|
[Editor(typeof(InitialConfigCollectionEditor<InitialConfigBase>), typeof(UITypeEditor))]
|
public List<IInitialConfig> DeviceConfigs { get; set; } = new List<IInitialConfig>();
|
#endregion
|
|
[Category("全局配置")]
|
[Description("是否使用离线图片 true:离线图片 false:在线图片")]
|
[DisplayName("离线图片")]
|
public bool IsImageOffline { get; set; }
|
|
[Category("全局配置")]
|
[Description("是否Demo模式 true:Demo模式 false:非Demo模式")]
|
[DisplayName("Demo模式")]
|
public bool IsDemoMode { get; set; }
|
|
[Category("日志配置")]
|
[Description("是否启用日志记录")]
|
[DisplayName("启用日志")]
|
public bool IsLogEnabled { get; set; }
|
|
[Category("日志配置")]
|
[Description("是否启用CSV数据记录")]
|
[DisplayName("启用CSV")]
|
public bool IsCSVOutputEnabled { get; set; }
|
|
[Category("日志配置")]
|
[Description("日志文件夹路径")]
|
[DisplayName("日志文件夹路径")]
|
[Editor(typeof(FoldDialogEditor), typeof(UITypeEditor))]
|
public string LogPath { get; set; } = "";
|
|
[Category("操作配置")]
|
[Description("默认操作配置集合")]
|
[DisplayName("默认操作配置")]
|
[TypeConverter(typeof(CollectionCountConvert))]
|
[Editor(typeof(ComplexCollectionEditor<SimpleMonitorSet>), typeof(UITypeEditor))]
|
public List<IMonitorSet> MonitorSetCollection { get; set; } = new List<IMonitorSet>();
|
|
public virtual List<IInitialConfig> GetAllDeviceInitialConfigs()
|
{
|
List<IInitialConfig> configs = new List<IInitialConfig>();
|
|
configs.AddRange(CameraConfigCollection);
|
configs.AddRange(PLCConfigCollection);
|
configs.AddRange(DeviceConfigs);
|
|
return configs;
|
}
|
|
public List<IMonitorSet> GetAllMonitorSet()
|
{
|
List<IMonitorSet> list = new List<IMonitorSet>();
|
list.AddRange(MonitorSetCollection);
|
|
GetType().GetProperties().ToList().ForEach(p =>
|
{
|
var pValue = p.GetValue(this);
|
|
if (pValue is IMonitorConfig msCollection)
|
{
|
list.AddRange(msCollection.GetAllMonitorSet());
|
}
|
else if (pValue is IList enumList)
|
{
|
foreach (var temp in enumList)
|
{
|
if (temp is IMonitorConfig tempCollection)
|
{
|
list.AddRange(tempCollection.GetAllMonitorSet());
|
}
|
}
|
}
|
});
|
|
return list;
|
}
|
}
|
}
|