领胜LDS 键盘AOI检测项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using static Bro.Common.Helper.EnumHelper;
 
namespace Bro.Common.Helper
{
    /// <summary>
    /// 设备特性,指示该信息的设备类型,适用于设备信息和配置信息
    /// </summary>
    public class DeviceAttribute : Attribute
    {
        /// <summary>
        /// 设备类型
        /// </summary>
        public string TypeCode { get; set; }
 
        public string TypeDescription { get; set; }
 
        /// <summary>
        /// 特性修饰类别
        /// </summary>
        public DeviceAttributeType AttrType { get; set; }
 
        public DeviceAttribute(string typeCode, string typeDesc, EnumHelper.DeviceAttributeType attrType)
        {
            TypeCode = typeCode;
            TypeDescription = typeDesc;
            AttrType = attrType;
        }
    }
 
    /// <summary>
    /// 预置状态特性  指定该修饰信息的前置状态允许范围
    /// </summary>
    public class PreStateAttribute : Attribute
    {
        public int PreState { get; set; }
        public PreStateAttribute(int _preState)
        {
            PreState = _preState;
        }
 
        /// <summary>
        /// 检查当前待执行操作的前置状态要求是否合法
        /// </summary>
        /// <param name="currentState"></param>
        /// <returns></returns>
        public bool CheckPreStateValid(int currentState)
        {
            return (currentState & PreState) == currentState;
        }
    }
 
    public class ColorSelectAttribute : Attribute
    {
        public string SelectedColor { get; set; }
        public ColorSelectAttribute(string selectedColor)
        {
            SelectedColor = selectedColor;
        }
    }
 
    public class FontColorSelectAttribute : Attribute
    {
        public string SelectedColor { get; set; }
        public FontColorSelectAttribute(string selectedColor)
        {
            SelectedColor = selectedColor;
        }
    }
 
    public enum InvokeType
    {
        /// <summary>
        /// 不公开调用
        /// </summary>
        [Description("不公开调用")]
        NoneInvoke = 0,
        /// <summary>
        /// 测试调用
        /// </summary>
        [Description("测试调用")]
        TestInvoke = 1,
        /// <summary>
        /// 标定调用
        /// </summary>
        [Description("标定调用")]
        CalibInvoke = 2,
    }
 
    /// <summary>
    /// 用来修饰对外开放的调用方法的特性
    /// 调用方法参数顺序:IOperationConfig,InvokeDevice,SourceDevice
    /// </summary>
    public class ProcessMethodAttribute : Attribute
    {
        public string MethodCode { get; set; }
        public string MethodDesc { get; set; }
 
        /// <summary>
        /// 是否提供人工调用测试
        /// </summary>
        public InvokeType InvokeType { get; set; }
 
        public string DeviceType { get; set; }
 
        public ProcessMethodAttribute(string deviceType, string code, string description, InvokeType invokeType)
        {
            DeviceType = deviceType;
            MethodCode = code;
            MethodDesc = description;
            InvokeType = invokeType;
        }
    }
 
    public class SwitchDisplayAttribute : Attribute
    {
        public string SwitchName { get; set; }
 
        public bool SwithOnStatus { get; set; } = true;
 
        public SwitchDisplayAttribute(string name, bool status)
        {
            SwitchName = name;
            SwithOnStatus = status;
        }
    }
 
    public class ElementAttribute : Attribute
    {
        public string Name { get; set; }
 
        public string Desc { get; set; }
 
        public string IconPath { get; set; }
 
        public bool IsShowInToolBar { get; set; }
 
        public ElementAttribute(string desc, string iconPath, bool isShowInToolBar = true, [CallerMemberName] string name = "")
        {
            Name = name;
            Desc = desc;
            IconPath = iconPath;
            IsShowInToolBar = isShowInToolBar;
        }
    }
 
    public class ProcessAttribute : Attribute
    {
        public string ProcessCode { get; set; }
        public DeviceAttributeType AttrType { get; set; }
 
        public ProcessAttribute(string stationCode, DeviceAttributeType attrType)
        {
            ProcessCode = stationCode;
            AttrType = attrType;
        }
    }
}