Class EventSimulationSequenceBuilder
- Namespace
- SharpHook
- Assembly
- SharpHook.dll
Represents a builder for a sequence of events that can be simulated together.
public sealed class EventSimulationSequenceBuilder : IEventSimulationSequenceBuilder
- Inheritance
-
EventSimulationSequenceBuilder
- Implements
- Inherited Members
- Extension Methods
Constructors
EventSimulationSequenceBuilder(IEventSimulationProvider?)
Initializes a new instance of the EventSimulationSequenceBuilder class.
public EventSimulationSequenceBuilder(IEventSimulationProvider? simulationProvider = null)
Parameters
simulationProviderIEventSimulationProviderThe simulation functionality provider (or Instance if null).
Methods
AddEvent(UioHookEvent)
Adds the specified event to the sequence of events to simulate.
public IEventSimulationSequenceBuilder AddEvent(UioHookEvent e)
Parameters
eUioHookEventThe event to add to the sequence.
Returns
- IEventSimulationSequenceBuilder
The current builder.
AddEvents(params UioHookEvent[])
Adds the specified events to the sequence of events to simulate.
public IEventSimulationSequenceBuilder AddEvents(params UioHookEvent[] events)
Parameters
eventsUioHookEvent[]The events to add to the sequence.
Returns
- IEventSimulationSequenceBuilder
The current builder.
Exceptions
- ArgumentNullException
eventsis null.
AddEvents(IEnumerable<UioHookEvent>)
Adds the specified events to the sequence of events to simulate.
public IEventSimulationSequenceBuilder AddEvents(IEnumerable<UioHookEvent> events)
Parameters
eventsIEnumerable<UioHookEvent>The events to add to the sequence.
Returns
- IEventSimulationSequenceBuilder
The current builder.
Exceptions
- ArgumentNullException
eventsis null.
AddKeyPress(KeyCode)
Adds a key press event to the sequence of events to simulate.
public IEventSimulationSequenceBuilder AddKeyPress(KeyCode keyCode)
Parameters
keyCodeKeyCodeThe code of the key to press.
Returns
- IEventSimulationSequenceBuilder
The current builder.
AddKeyRelease(KeyCode)
Adds a key release event to the sequence of events to simulate.
public IEventSimulationSequenceBuilder AddKeyRelease(KeyCode keyCode)
Parameters
keyCodeKeyCodeThe code of the key to press.
Returns
- IEventSimulationSequenceBuilder
The current builder.
AddMouseMovement(short, short)
Adds a mouse movement event to the sequence of events to simulate.
public IEventSimulationSequenceBuilder AddMouseMovement(short x, short y)
Parameters
xshortThe target X-coordinate of the mouse pointer.
yshortThe target Y-coordinate of the mouse pointer.
Returns
- IEventSimulationSequenceBuilder
The current builder.
AddMouseMovementRelative(short, short)
Adds a relative mouse movement event to the sequence of events to simulate.
public IEventSimulationSequenceBuilder AddMouseMovementRelative(short x, short y)
Parameters
Returns
- IEventSimulationSequenceBuilder
The current builder.
AddMousePress(MouseButton)
Adds a mouse button press event to the sequence of events to simulate.
public IEventSimulationSequenceBuilder AddMousePress(MouseButton button)
Parameters
buttonMouseButtonThe mouse button to press.
Returns
- IEventSimulationSequenceBuilder
The current builder.
AddMousePress(MouseButton, ushort)
Adds a mouse button press event to the sequence of events to simulate.
public IEventSimulationSequenceBuilder AddMousePress(MouseButton button, ushort clicks)
Parameters
buttonMouseButtonThe mouse button to press.
clicksushortThe click count (used only on macOS).
Returns
- IEventSimulationSequenceBuilder
The current builder.
AddMousePress(short, short, MouseButton)
Adds a mouse button press event to the sequence of events to simulate.
public IEventSimulationSequenceBuilder AddMousePress(short x, short y, MouseButton button)
Parameters
xshortThe target X-coordinate of the mouse pointer.
yshortThe target Y-coordinate of the mouse pointer.
buttonMouseButtonThe mouse button to press.
Returns
- IEventSimulationSequenceBuilder
The current builder.
AddMousePress(short, short, MouseButton, ushort)
Adds a mouse button press event to the sequence of events to simulate.
public IEventSimulationSequenceBuilder AddMousePress(short x, short y, MouseButton button, ushort clicks)
Parameters
xshortThe target X-coordinate of the mouse pointer.
yshortThe target Y-coordinate of the mouse pointer.
buttonMouseButtonThe mouse button to press.
clicksushortThe click count (used only on macOS).
Returns
- IEventSimulationSequenceBuilder
The current builder.
AddMouseRelease(MouseButton)
Adds a mouse button release event to the sequence of events to simulate.
public IEventSimulationSequenceBuilder AddMouseRelease(MouseButton button)
Parameters
buttonMouseButtonThe mouse button to release.
Returns
- IEventSimulationSequenceBuilder
The current builder.
AddMouseRelease(MouseButton, ushort)
Adds a mouse button release event to the sequence of events to simulate.
public IEventSimulationSequenceBuilder AddMouseRelease(MouseButton button, ushort clicks)
Parameters
buttonMouseButtonThe mouse button to release.
clicksushortThe click count (used only on macOS).
Returns
- IEventSimulationSequenceBuilder
The current builder.
AddMouseRelease(short, short, MouseButton)
Adds a mouse button release event to the sequence of events to simulate.
public IEventSimulationSequenceBuilder AddMouseRelease(short x, short y, MouseButton button)
Parameters
xshortThe target X-coordinate of the mouse pointer.
yshortThe target Y-coordinate of the mouse pointer.
buttonMouseButtonThe mouse button to release.
Returns
- IEventSimulationSequenceBuilder
The current builder.
AddMouseRelease(short, short, MouseButton, ushort)
Adds a mouse button release event to the sequence of events to simulate.
public IEventSimulationSequenceBuilder AddMouseRelease(short x, short y, MouseButton button, ushort clicks)
Parameters
xshortThe target X-coordinate of the mouse pointer.
yshortThe target Y-coordinate of the mouse pointer.
buttonMouseButtonThe mouse button to release.
clicksushortThe click count (used only on macOS).
Returns
- IEventSimulationSequenceBuilder
The current builder.
AddMouseWheel(short, MouseWheelScrollDirection, MouseWheelScrollType)
Adds a mouse wheel scroll event to the sequence of events to simulate.
public IEventSimulationSequenceBuilder AddMouseWheel(short rotation, MouseWheelScrollDirection direction = MouseWheelScrollDirection.Vertical, MouseWheelScrollType type = MouseWheelScrollType.UnitScroll)
Parameters
rotationshortThe wheel rotation. A positive value indicates that the wheel will be rotated up or left, and a negative value indicates that the wheel will be rotated down or right.
directionMouseWheelScrollDirectionThe scroll direction.
typeMouseWheelScrollTypeThe scroll type (considered only on macOS).
Returns
- IEventSimulationSequenceBuilder
The current builder.
Remarks
On Windows, the value 120 represents the default wheel step. As such, multiples of 120 can be
used, but it's not required. The value of type is ignored.
On macOS, it's recommended to use values between -10 and 10. This will result in quite a small
scroll amount with pixel scrolling, so BlockScroll is recommended for line
scrolling instead of pixel scrolling.
On Linux, there is no fixed recommendation, but multiples of 100 can be used. The value of
type is ignored.
CreateTemplate()
Creates a template based on the events in this sequence.
public IEventSimulationSequenceTemplate CreateTemplate()
Returns
- IEventSimulationSequenceTemplate
A template based on the events in this sequence.
RemoveEvent(UioHookEvent)
Removes the specified event from the sequence of events to simulate.
public IEventSimulationSequenceBuilder RemoveEvent(UioHookEvent e)
Parameters
eUioHookEventThe event to remove from the sequence.
Returns
- IEventSimulationSequenceBuilder
The current builder.
RemoveEvents(Func<UioHookEvent, bool>)
Removes the specified events from the sequence of events to simulate.
public IEventSimulationSequenceBuilder RemoveEvents(Func<UioHookEvent, bool> predicate)
Parameters
predicateFunc<UioHookEvent, bool>The predicate to check if the event should be removed from the sequence.
Returns
- IEventSimulationSequenceBuilder
The current builder.
Simulate()
Simulates the events in this sequence.
public UioHookResult Simulate()
Returns
- UioHookResult
The result of the operation.