Class Robot

GoDiagram®
v10.0.11
by Northwoods Software®

A class for simulating mouse and keyboard input.

Inheritance
Robot
Namespace: Northwoods.Go.Extensions
Assembly: RobotAvalonia.dll
Syntax
public class Robot
Remarks

As a special hack, this supports limited simulation of drag-and-drop between Diagrams, by setting the SourceDiagram and TargetDiagram properties on the "eventprops" arguments of the MouseDown/MouseMove/MouseUp methods. Although TargetDiagram is a real property, the SourceDiagram property is only used by these Robot methods.

Constructors

Robot(Diagram)

Construct a Robot for a given Diagram. If none is provided, a new Diagram will be created.

Declaration
public Robot(Diagram diagram = null)
Parameters
Type Name Description
Diagram diagram

Properties

Diagram

Gets or sets the Diagram associated with this Robot.

Declaration
public Diagram Diagram { get; set; }
Property Value
Type Description
Diagram

Methods

KeyDown(string, long, Action<InputEvent>)

Simulate a key down event.

Declaration
public void KeyDown(string key, long time = 0, Action<InputEvent> evtFn = null)
Parameters
Type Name Description
string key
long time

the timestamp of the simulated event, in milliseconds; default zero

Action<InputEvent> evtFn

an optional function to apply to the InputEvent, which can be used to set properties

KeyUp(string, long, Action<InputEvent>)

Simulate a key up event.

Declaration
public void KeyUp(string key, long time = 0, Action<InputEvent> evtFn = null)
Parameters
Type Name Description
string key
long time

the timestamp of the simulated event, in milliseconds; default zero

Action<InputEvent> evtFn

an optional function to apply to the InputEvent, which can be used to set properties

MouseDown(double, double, long, Action<InputEvent>, Diagram)

Simulate a mouse down event.

Declaration
public void MouseDown(double x, double y, long time = 0, Action<InputEvent> evtFn = null, Diagram sourceDiagram = null)
Parameters
Type Name Description
double x

the X-coordinate of the mouse point in document coordinates.

double y

the Y-coordinate of the mouse point in document coordinates.

long time

the timestamp of the simulated event, in milliseconds; default zero

Action<InputEvent> evtFn

an optional function to apply to the InputEvent, which can be used to set properties

Diagram sourceDiagram

the optional source diagram to apply the InputEvent

MouseMove(double, double, long, Action<InputEvent>, Diagram)

Simulate a mouse move event.

Declaration
public void MouseMove(double x, double y, long time = 0, Action<InputEvent> evtFn = null, Diagram sourceDiagram = null)
Parameters
Type Name Description
double x

the X-coordinate of the mouse point in document coordinates.

double y

the Y-coordinate of the mouse point in document coordinates.

long time

the timestamp of the simulated event, in milliseconds; default zero

Action<InputEvent> evtFn

an optional function to apply to the InputEvent, which can be used to set properties

Diagram sourceDiagram

the optional source diagram to apply the InputEvent

MouseUp(double, double, long, Action<InputEvent>, Diagram)

Simulate a mouse up event.

Declaration
public void MouseUp(double x, double y, long time = 0, Action<InputEvent> evtFn = null, Diagram sourceDiagram = null)
Parameters
Type Name Description
double x

the X-coordinate of the mouse point in document coordinates.

double y

the Y-coordinate of the mouse point in document coordinates.

long time

the timestamp of the simulated event, in milliseconds; default zero

Action<InputEvent> evtFn

an optional function to apply to the InputEvent, which can be used to set properties

Diagram sourceDiagram

the optional source diagram to apply the InputEvent

MouseWheel(double, long, Action<InputEvent>)

Simulate a mouse down event.

Declaration
public void MouseWheel(double delta, long time = 0, Action<InputEvent> evtFn = null)
Parameters
Type Name Description
double delta

non-zero turn

long time

the timestamp of the simulated event, in milliseconds; default zero

Action<InputEvent> evtFn

an optional function to apply to the InputEvent, which can be used to set properties