BioImager  3.9.1
A .NET microscopy imaging library. Supports various microscopes by using imported libraries & GUI automation. Supported libraries include PriorĀ® & ZeissĀ® & all devices supported by Micromanager 2.0 and python-microscope.
Loading...
Searching...
No Matches
BioImager.Automation.Action Class Reference

Public Types

enum  Type
 
enum  ValueType
 

Public Member Functions

 Action (Type t, int proc, KeyEventArgs e)
 
 Action (Type t, int proc, KeyPressEventArgs e)
 
 Action (Type t, int proc, MouseEventArgs e)
 
 Action (Type t, string process, string title, int index, string id, string name, string classname, MouseEventArgs mo)
 
 Action (Type t, string process, string title, int index, string id, string name, string classname, KeyEventArgs ke)
 
 Action (Type t, string process, string title, int index, string id, string name, string classname, KeyPressEventArgs ke)
 
 Action (Type t, string process, string title, int index, string id, string name, string classname)
 
void Perform ()
 
override string ToString ()
 

Properties

Type ActionType [get, set]
 
Keys Key [get]
 
MouseButtons Button [get, set]
 
System.Drawing.Point Point [get, set]
 
string AutomationID [get, set]
 
string Name [get, set]
 
string ClassName [get, set]
 
string ProcessName [get, set]
 
string Title [get, set]
 
int Index [get, set]
 
ValueType Value [get, set]
 

Detailed Description

Definition at line 18 of file Automation.cs.

Member Enumeration Documentation

◆ Type

enum BioImager.Automation.Action.Type

Definition at line 33 of file Automation.cs.

34 {
35 mousedown,
36 mouseup,
37 mousemove,
38 wheeldown,
39 wheelup,
40 keyup,
41 keydown,
42 keypress,
43 }

◆ ValueType

enum BioImager.Automation.Action.ValueType

Definition at line 44 of file Automation.cs.

45 {
46 Name,
47 ValuePattern,
48 SelectionPattern,
49 TextPattern,
50 TogglePattern,
51 Image,
52 }

Constructor & Destructor Documentation

◆ Action() [1/7]

BioImager.Automation.Action.Action ( Type  t,
int  proc,
KeyEventArgs  e 
)

Definition at line 118 of file Automation.cs.

119 {
120 type = t;
121 key = e;
122 AutomationElement el = Element;
123 name = el.Name;
124 automationID = el.AutomationId;
125 className = el.ClassName;
126 Process p = Process.GetProcessById(proc);
127 ProcessName = p.ProcessName;
128 title = Win32.GetActiveWindowTitle();
129 }

◆ Action() [2/7]

BioImager.Automation.Action.Action ( Type  t,
int  proc,
KeyPressEventArgs  e 
)

Definition at line 130 of file Automation.cs.

131 {
132 type = t;
133 keyPress = e;
134 AutomationElement el = Element;
135 name = el.Name;
136 automationID = el.AutomationId;
137 className = el.ClassName;
138 Process p = Process.GetProcessById(proc);
139 ProcessName = p.ProcessName;
140 title = Win32.GetActiveWindowTitle();
141 }

◆ Action() [3/7]

BioImager.Automation.Action.Action ( Type  t,
int  proc,
MouseEventArgs  e 
)

Definition at line 142 of file Automation.cs.

143 {
144 type = t;
145 mouse = e;
146 AutomationElement el = Element;
147 name = el.Name;
148 try
149 {
150 automationID = el.AutomationId;
151 }
152 catch (Exception)
153 {
154 }
155
156 className = el.Properties.LocalizedControlType.Value.ToString();
157 mouseButton = e.Button;
158 point = new Point((int)(e.Location.X - el.BoundingRectangle.X), (int)(e.Location.Y - el.BoundingRectangle.Y));
159 Process p = Process.GetProcessById(proc);
160 title = p.MainWindowTitle;
161 ProcessName = p.ProcessName;
162 Index = AutomationHelpers.GetIndex(ProcessName, Title, AutomationID, Name, ClassName, e.Location);
163 }

◆ Action() [4/7]

BioImager.Automation.Action.Action ( Type  t,
string  process,
string  title,
int  index,
string  id,
string  name,
string  classname,
MouseEventArgs  mo 
)

Definition at line 164 of file Automation.cs.

165 {
166 type = t;
167 this.automationID = id;
168 this.process = process;
169 this.name = name;
170 this.className = classname;
171 this.mouseButton = mo.Button;
172 this.title = title;
173 this.index = index;
174 type = t;
175 point = mo.Location;
176 mouse = mo;
177 }

◆ Action() [5/7]

BioImager.Automation.Action.Action ( Type  t,
string  process,
string  title,
int  index,
string  id,
string  name,
string  classname,
KeyEventArgs  ke 
)

Definition at line 178 of file Automation.cs.

179 {
180 type = t;
181 key = ke;
182 this.automationID = id;
183 this.name = name;
184 this.process = process;
185 this.className = classname;
186 this.index = index;
187 this.title = title;
188 type = t;
189 }

◆ Action() [6/7]

BioImager.Automation.Action.Action ( Type  t,
string  process,
string  title,
int  index,
string  id,
string  name,
string  classname,
KeyPressEventArgs  ke 
)

Definition at line 190 of file Automation.cs.

191 {
192 type = t;
193 keyPress = ke;
194 this.automationID = id;
195 this.process = process;
196 this.name = name;
197 this.className = classname;
198 this.index = index;
199 this.title = title;
200 type = t;
201 }

◆ Action() [7/7]

BioImager.Automation.Action.Action ( Type  t,
string  process,
string  title,
int  index,
string  id,
string  name,
string  classname 
)

Definition at line 202 of file Automation.cs.

203 {
204 this.automationID = id;
205 this.name = name;
206 this.className = classname;
207 this.automationID = id;
208 this.process = process;
209 this.name = name;
210 this.className = classname;
211 this.index = index;
212 this.title = title;
213 type = t;
214 }

Member Function Documentation

◆ Perform()

void BioImager.Automation.Action.Perform ( )

Definition at line 215 of file Automation.cs.

216 {
217 Stopwatch stopwatch = new Stopwatch();
218 stopwatch.Start();
219 AutomationElement el = AutomationHelpers.GetElementByProcess(ProcessName, Title, AutomationID, Name, ClassName, Index);
220 if (type == Type.mousedown)
221 {
222 Cursor.Position = new Point((int)el.BoundingRectangle.X + Point.X, (int)el.BoundingRectangle.Y + Point.Y);
223 if (mouse.Button == MouseButtons.Left)
224 MouseOperations.LeftClick();
225
226 if (mouse.Button == MouseButtons.Right)
227 MouseOperations.RightClick();
228 }
229 else if (type == Type.mouseup)
230 {
231 Cursor.Position = new Point((int)el.BoundingRectangle.X + Point.X, (int)el.BoundingRectangle.Y + Point.Y);
232 if (mouse.Button == MouseButtons.Left)
233 MouseOperations.LeftClick();
234 if (mouse.Button == MouseButtons.Right)
235 MouseOperations.RightClick();
236 }
237 else if (type == Type.keydown)
238 {
239 Win32.SetFocus(ProcessName);
240 input.Keyboard.KeyDown((VirtualKeyCode)key.KeyValue);
241 }
242 else if (type == Type.keyup)
243 {
244 Win32.SetFocus(ProcessName);
245 input.Keyboard.KeyUp((VirtualKeyCode)key.KeyValue);
246 }
247 else if (type == Type.keypress)
248 {
249 Win32.SetFocus(ProcessName);
250 SendKeys.Send(keyPress.KeyChar.ToString());
251 }
252 else if (type == Type.wheelup)
253 {
254 Win32.SetFocus(ProcessName);
255 //input.Mouse.VerticalScroll(1);
256 Win32.MouseWheelUp();
257 }
258 else if (type == Type.wheeldown)
259 {
260 Win32.SetFocus(ProcessName);
261 //input.Mouse.VerticalScroll(-1);
262 Win32.MouseWheelDown();
263 }
264 stopwatch.Stop();
265 ticks = stopwatch.ElapsedMilliseconds;
266 stopwatch = null;
267 }

◆ ToString()

override string BioImager.Automation.Action.ToString ( )

Definition at line 268 of file Automation.cs.

269 {
270 if(type == Type.keyup || type == Type.keydown)
271 return Name + ", " + AutomationID + ", " + ClassName + ", " + ActionType + ", " + Index + ", " + key.KeyValue;
272 else
273 if (type == Type.keypress)
274 return Name + ", " + AutomationID + ", " + ClassName + ", " + ActionType + ", " + Index + ", " + keyPress.KeyChar;
275 else
276 if (type == Type.mouseup || type == Type.mousedown)
277 return Name + ", " + AutomationID + ", " + ClassName + ", " + ActionType + ", " + Index + ", " + point.ToString();
278 else
279 return Name + ", " + AutomationID + ", " + ClassName + ", " + ActionType + ", " + Index + ", " + mouse.Delta;
280 }

Property Documentation

◆ ActionType

Type BioImager.Automation.Action.ActionType
getset

Definition at line 55 of file Automation.cs.

56 {
57 get { return type; }
58 set { type = value; }
59 }

◆ AutomationID

string BioImager.Automation.Action.AutomationID
getset

Definition at line 83 of file Automation.cs.

84 {
85 get { return automationID; }
86 set { automationID = value; }
87 }

◆ Button

MouseButtons BioImager.Automation.Action.Button
getset

Definition at line 73 of file Automation.cs.

74 {
75 get { return mouseButton; }
76 set { mouseButton = value; }
77 }

◆ ClassName

string BioImager.Automation.Action.ClassName
getset

Definition at line 93 of file Automation.cs.

94 {
95 get { return className; }
96 set { className = value; }
97 }

◆ Index

int BioImager.Automation.Action.Index
getset

Definition at line 108 of file Automation.cs.

109 {
110 get { return index; }
111 set { index = value; }
112 }

◆ Key

Keys BioImager.Automation.Action.Key
get

Definition at line 60 of file Automation.cs.

61 {
62 get
63 {
64 if (key != null)
65 return key.KeyCode;
66 else
67 if (keyPress != null)
68 return (Keys)keyPress.KeyChar;
69 else
70 return Keys.None;
71 }
72 }

◆ Name

string BioImager.Automation.Action.Name
getset

Definition at line 88 of file Automation.cs.

89 {
90 get { return name; }
91 set { name = value; }
92 }

◆ Point

System.Drawing.Point BioImager.Automation.Action.Point
getset

Definition at line 78 of file Automation.cs.

79 {
80 get { return point; }
81 set { point = value; }
82 }

◆ ProcessName

string BioImager.Automation.Action.ProcessName
getset

Definition at line 98 of file Automation.cs.

99 {
100 get { return process; }
101 set { process = value; }
102 }

◆ Title

string BioImager.Automation.Action.Title
getset

Definition at line 103 of file Automation.cs.

104 {
105 get { return title; }
106 set { title = value; }
107 }

◆ Value

ValueType BioImager.Automation.Action.Value
getset

Definition at line 113 of file Automation.cs.

114 {
115 get { return autoValue; }
116 set { autoValue = value; }
117 }

The documentation for this class was generated from the following file: