Table of Contents

Class R3GlobalHookAdapter

Namespace
SharpHook.R3
Assembly
SharpHook.R3.dll

Adapts an IGlobalHook to the IR3GlobalHook interface.

public sealed class R3GlobalHookAdapter : IGlobalHook, IR3GlobalHook, IBasicGlobalHook, IDisposable
Inheritance
R3GlobalHookAdapter
Implements
Inherited Members

Constructors

R3GlobalHookAdapter(IGlobalHook, TimeProvider?)

Initializes a new instance of R3GlobalHookAdapter.

public R3GlobalHookAdapter(IGlobalHook hook, TimeProvider? defaultTimeProvider = null)

Parameters

hook IGlobalHook

The hook to adapt.

defaultTimeProvider TimeProvider

The default time provider for observables, or null to use the default one as defined in R3.ObservableSystem.DefaultTimeProvider.

Properties

HookDisabled

Gets an observable which emits a value when the global hook is disabled.

public Observable<HookEventArgs> HookDisabled { get; }

Property Value

Observable<HookEventArgs>

An observable which emits a value when the global hook is disabled.

Remarks

The observable emits a value when the Stop() or Dispose() method is called.

HookEnabled

Gets an observable which emits a value when the global hook is enabled.

public Observable<HookEventArgs> HookEnabled { get; }

Property Value

Observable<HookEventArgs>

An observable which emits a value when the global hook is enabled.

Remarks

The observable emits a value when the Run() or RunAsync() method is called.

IsDisposed

Gets the value which indicates whether the global hook is disposed.

public bool IsDisposed { get; }

Property Value

bool

true if the global hook is disposed. Otherwise, false.

Remarks

A disposed global hook cannot be started again.

IsRunning

Gets the value which indicates whether the global hook is running.

public bool IsRunning { get; }

Property Value

bool

true if the global hook is running. Otherwise, false.

KeyPressed

Gets an observable which emits a value when a key is pressed.

public Observable<KeyboardHookEventArgs> KeyPressed { get; }

Property Value

Observable<KeyboardHookEventArgs>

An observable which emits a value when a key is pressed.

KeyReleased

Gets an observable which emits a value when a key is released.

public Observable<KeyboardHookEventArgs> KeyReleased { get; }

Property Value

Observable<KeyboardHookEventArgs>

An observable which emits a value when a key is released.

KeyTyped

Gets an observable which emits a value when a key is typed.

public Observable<KeyboardHookEventArgs> KeyTyped { get; }

Property Value

Observable<KeyboardHookEventArgs>

An observable which emits a value when a key is typed.

MouseClicked

Gets an observable which emits a value when a mouse button is clicked.

public Observable<MouseHookEventArgs> MouseClicked { get; }

Property Value

Observable<MouseHookEventArgs>

An observable which emits a value when a mouse button is clicked.

MouseDragged

Gets an observable which emits a value when the mouse cursor is dragged.

public Observable<MouseHookEventArgs> MouseDragged { get; }

Property Value

Observable<MouseHookEventArgs>

An observable which emits a value when the mouse cursor is dragged.

MouseMoved

Gets an observable which emits a value when the mouse cursor is moved.

public Observable<MouseHookEventArgs> MouseMoved { get; }

Property Value

Observable<MouseHookEventArgs>

An observable which emits a value when the mouse cursor is moved.

MousePressed

Gets an observable which emits a value when a mouse button is pressed.

public Observable<MouseHookEventArgs> MousePressed { get; }

Property Value

Observable<MouseHookEventArgs>

An observable which emits a value when a mouse button is pressed.

MouseReleased

Gets an observable which emits a value when a mouse button is released.

public Observable<MouseHookEventArgs> MouseReleased { get; }

Property Value

Observable<MouseHookEventArgs>

An observable which emits a value when a mouse button is released.

MouseWheel

Gets an observable which emits a value when the mouse wheel is scrolled.

public Observable<MouseWheelHookEventArgs> MouseWheel { get; }

Property Value

Observable<MouseWheelHookEventArgs>

An observable which emits a value when the mouse wheel is scrolled.

Methods

Dispose()

Disposes of the global hook, stopping it if it is running.

public void Dispose()

Remarks

After calling this method, the hook cannot run again. If you want to stop the global hook with the ability to run it again, call the Stop() method instead.

Exceptions

HookException

Stopping the hook has failed.

Run()

Runs the global hook on the current thread, blocking it. The hook can be stopped by calling the Stop() or the Dispose() methods.

public void Run()

Exceptions

HookException

Starting the global hook has failed.

InvalidOperationException

The global hook is already running.

ObjectDisposedException

The global hook has been disposed.

RunAsync()

Runs the global hook without blocking the current thread. The hook can be stopped by calling the Stop() or the Dispose() methods.

public Task RunAsync()

Returns

Task

A task which is completed when the hook is stopped.

Remarks

The hook is started on a separate thread.

Exceptions

HookException

Starting the global hook has failed.

InvalidOperationException

The global hook is already running.

ObjectDisposedException

The global hook has been disposed.

Stop()

Stops the global hook.

public void Stop()

Remarks

After stopping, the global hook can run again.

Exceptions

ObjectDisposedException

The global hook has been disposed.

See Also