领胜LDS 键盘AOI检测项目
wells.liu
2020-07-06 99587d3c26f5b952cb7dc87a56be91b08c5d277b
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
using System;
using System.Collections.Generic;
using System.Drawing;
using static Bro.Common.Helper.EnumHelper;
 
namespace Bro.UI.Model.Winform
{
    //public static class AOIEnumHelper
    //{
    //    public enum ElementState
    //    {
    //        New = 1,
    //        MouseHover = 2,
    //        MouseInSide = 3,
    //        Selected = 4,
    //        Moving = 5,
 
    //        Normal = 11,
 
    //        Measuring = 21,
    //        MeasureDoneOK = 22,
    //        MeasureDoneNG = 23,
    //    }
 
    //    public enum MouseState
    //    {
    //        Normal = 1,
    //        HoverElement = 2,
    //        InSideElement = 3,
 
    //        StretchingLeft = 11,
    //        StretchingRight = 12,
    //        StretchingUp = 13,
    //        StretchingDown = 14,
    //        MoveElement = 15,
 
    //        New = 21,
    //        Editing = 22,
    //        SelectedElement = 23,
 
    //        MovingAll = 31,
 
    //        SelectionZone = 41,
    //        SelectionZoneDoing = 42,
    //    }
 
    //    public enum RunMode
    //    {
    //        [Description("设置模式")]
    //        SetMode = 0,
    //        [Description("运行模式")]
    //        RunMode = 1,
    //    }
    //}
 
    public static class EventRouter
    {
        /// <summary>
        /// ElementBase 基元
        /// 1st MouseState 初始状态
        /// 2nd MouseState 变化状态
        /// </summary>
        public static Action<ElementBase, ElementState, ElementState> ChangeElementsMouseState;
    }
 
    public class NoticedPoints : List<Point>
    {
        public Action OnItemChanged;
 
        public new Point this[int index]
        {
            get
            {
                if (index >= 0 && index < Count)
                {
                    return base[index];
                }
                else
                {
                    return new Point();
                }
 
            }
            set
            {
                if (base[index] != value)
                {
                    base[index] = value;
                    OnItemChanged?.Invoke();
                }
            }
        }
 
        public new void Add(Point item)
        {
            lock (this)
            {
                base.Add(item);
                OnItemChanged?.Invoke();
            }
        }
 
        public new void AddRange(IEnumerable<Point> collection)
        {
            lock (this)
            {
                base.AddRange(collection);
                OnItemChanged?.Invoke();
            }
        }
 
        public new void Clear()
        {
            lock (this)
            {
                base.Clear();
                OnItemChanged?.Invoke();
            }
        }
 
        public new void Insert(int index, Point item)
        {
            lock (this)
            {
                base.Insert(index, item);
                OnItemChanged?.Invoke();
            }
        }
 
        public new void InsertRange(int index, IEnumerable<Point> collection)
        {
            lock (this)
            {
                base.InsertRange(index, collection);
                OnItemChanged?.Invoke();
            }
        }
 
        public new bool Remove(Point item)
        {
            lock (this)
            {
                bool flag = base.Remove(item);
 
                if (flag)
                {
                    OnItemChanged?.Invoke();
                }
 
                return flag;
            }
        }
 
        public new int RemoveAll(Predicate<Point> match)
        {
            lock (this)
            {
                int i = base.RemoveAll(match);
                if (i > 0)
                {
                    OnItemChanged?.Invoke();
                }
 
                return i;
            }
        }
 
        public new void RemoveAt(int index)
        {
            lock (this)
            {
                base.RemoveAt(index);
                OnItemChanged?.Invoke();
            }
        }
 
        public new void RemoveRange(int index, int count)
        {
            lock (this)
            {
                base.RemoveRange(index, count);
                OnItemChanged?.Invoke();
            }
        }
    }
}