Table of Contents

Class Robot

Namespace
Northwoods.Go.Extensions
Assembly
RobotWinForms.dll

A class for simulating mouse and keyboard input.

public class Robot
Inheritance
Robot
Inherited Members

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.

public Robot(Diagram diagram = null)

Parameters

diagram Diagram

Properties

Diagram

Gets or sets the Diagram associated with this Robot.

public Diagram Diagram { get; set; }

Property Value

Diagram

Methods

KeyDown(string, long, Action<InputEvent>)

Simulate a key down event.

public void KeyDown(string key, long time = 0, Action<InputEvent> evtFn = null)

Parameters

key string
time long

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

evtFn Action<InputEvent>

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.

public void KeyUp(string key, long time = 0, Action<InputEvent> evtFn = null)

Parameters

key string
time long

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

evtFn Action<InputEvent>

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.

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

Parameters

x double

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

y double

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

time long

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

evtFn Action<InputEvent>

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

sourceDiagram Diagram

the optional source diagram to apply the InputEvent

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

Simulate a mouse move event.

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

Parameters

x double

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

y double

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

time long

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

evtFn Action<InputEvent>

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

sourceDiagram Diagram

the optional source diagram to apply the InputEvent

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

Simulate a mouse up event.

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

Parameters

x double

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

y double

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

time long

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

evtFn Action<InputEvent>

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

sourceDiagram Diagram

the optional source diagram to apply the InputEvent

MouseWheel(double, long, Action<InputEvent>)

Simulate a mouse down event.

public void MouseWheel(double delta, long time = 0, Action<InputEvent> evtFn = null)

Parameters

delta double

non-zero turn

time long

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

evtFn Action<InputEvent>

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