Table of Contents

Class ReactiveGlobalHookAdapter

Namespace
SharpHook.Reactive
Assembly
SharpHook.Reactive.dll
public sealed class ReactiveGlobalHookAdapter : IGlobalHook, IReactiveGlobalHook, IBasicGlobalHook, IDisposable
Inheritance
ReactiveGlobalHookAdapter
Implements
Inherited Members

Constructors

ReactiveGlobalHookAdapter(IGlobalHook, IScheduler?)

public ReactiveGlobalHookAdapter(IGlobalHook hook, IScheduler? defaultScheduler = null)

Parameters

hook IGlobalHook
defaultScheduler IScheduler

Properties

HookDisabled

public IObservable<HookEventArgs> HookDisabled { get; }

Property Value

IObservable<HookEventArgs>

HookEnabled

public IObservable<HookEventArgs> HookEnabled { get; }

Property Value

IObservable<HookEventArgs>

IsDisposed

Gets the value which indicates whether the global hook has been disposed.

public bool IsDisposed { get; }

Property Value

bool

true if the global hook has been 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

public IObservable<KeyboardHookEventArgs> KeyPressed { get; }

Property Value

IObservable<KeyboardHookEventArgs>

KeyReleased

public IObservable<KeyboardHookEventArgs> KeyReleased { get; }

Property Value

IObservable<KeyboardHookEventArgs>

KeyTyped

public IObservable<KeyboardHookEventArgs> KeyTyped { get; }

Property Value

IObservable<KeyboardHookEventArgs>

MouseClicked

public IObservable<MouseHookEventArgs> MouseClicked { get; }

Property Value

IObservable<MouseHookEventArgs>

MouseDragged

public IObservable<MouseHookEventArgs> MouseDragged { get; }

Property Value

IObservable<MouseHookEventArgs>

MouseMoved

public IObservable<MouseHookEventArgs> MouseMoved { get; }

Property Value

IObservable<MouseHookEventArgs>

MousePressed

public IObservable<MouseHookEventArgs> MousePressed { get; }

Property Value

IObservable<MouseHookEventArgs>

MouseReleased

public IObservable<MouseHookEventArgs> MouseReleased { get; }

Property Value

IObservable<MouseHookEventArgs>

MouseWheel

public IObservable<MouseWheelHookEventArgs> MouseWheel { get; }

Property Value

IObservable<MouseWheelHookEventArgs>

Methods

Dispose()

public void Dispose()

Run()

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

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 temporarily by calling Stop() or stopped permanently by calling Dispose().

public Task RunAsync()

Returns

Task

A Task which finishes when the hook is stopped.

Remarks

Since the underlying native API for running a global hook is blocking, the only way to run it without blocking the current thread is to run it 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.