SharpHook.Reactive 4.1.0

.NET 6.0 .NET Standard 2.0 .NET Framework 4.6.1
dotnet add package SharpHook.Reactive --version 4.1.0
NuGet\Install-Package SharpHook.Reactive -Version 4.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SharpHook.Reactive" Version="4.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SharpHook.Reactive --version 4.1.0
#r "nuget: SharpHook.Reactive, 4.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SharpHook.Reactive as a Cake Addin
#addin nuget:?package=SharpHook.Reactive&version=4.1.0

// Install SharpHook.Reactive as a Cake Tool
#tool nuget:?package=SharpHook.Reactive&version=4.1.0

SharpHook.Reactive

SharpHook provides a cross-platform global keyboard and mouse hook for .NET, and the ability to simulate input events. It is a thin wrapper of libuiohook and provides direct access to its features as well as higher-level types to work with it.

If you're using Rx.NET, you can use the SharpHook.Reactive package to integrate SharpHook with Rx.NET.

Usage

Basic Usage

Refer to the SharpHook package for the basic usage guidelines.

Reactive Global Hooks

SharpHook.Reactive provides the IReactiveGlobalHook interface along with a default implementation and an adapter which you can use to use to control the hook and subscribe to its observables. Here's a basic example:

using SharpHook.Reactive;

// ...

var hook = new SimpleReactiveGlobalHook();

hook.HookEnabled.Subscribe(OnHookEnabled);
hook.HookDisabled.Subscribe(OnHookDisabled);

hook.KeyTyped.Subscribe(OnKeyTyped);
hook.KeyPressed.Subscribe(OnKeyPressed);
hook.KeyReleased.Subscribe(OnKeyReleased);

hook.MouseClicked.Subscribe(OnMouseClicked);
hook.MousePressed.Subscribe(OnMousePressed);
hook.MouseReleased.Subscribe(OnMouseReleased);

hook.MouseMoved
    .Throttle(TimeSpan.FromSeconds(0.5))
    .Subscribe(OnMouseMoved);

hook.MouseDragged
    .Throttle(TimeSpan.FromSeconds(0.5))
    .Subscribe(OnMouseDragged);

hook.MouseWheel.Subscribe(OnMouseWheel);

hook.Run();
// or
hook.RunAsync().Subscribe();

Reactive global hooks are basically the same as the default global hooks and the same rules apply to them.

SharpHook.Reactive provides two implementations of IReactiveGlobalHook:

  • SimpleReactiveGlobalHook. Since we are dealing with observables, it's up to you to decide when and where to handle the events through schedulers.

  • ReactiveGlobalHookAdapter adapts an IGlobalHook to IReactiveGlobalHook. All subscriptions and changes are propagated to the adapted hook.

Logging

SharpHook.Reactive contains the IReactiveLogSource and ReactiveLogSourceAdapter so you can use them in a more reactive way:

using SharpHook.Logging;
using SharpHook.Reactive.Logging;

// ...

var logSource = LogSource.Register();
var reactiveLogSource = new ReactiveLogSourceAdapter(logSource);
reactiveLogSource.MessageLogged.Subscribe(this.OnMessageLogged);

Icon

Icon made by Freepik from www.flaticon.com.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.1.0 75 3/26/2023
4.0.1 133 3/12/2023
4.0.0 795 11/9/2022
3.1.3 290 10/27/2022
3.1.2 304 10/19/2022
3.1.1 345 8/5/2022
3.1.0 287 7/30/2022
3.0.2 388 7/1/2022
3.0.1 281 6/25/2022
3.0.0 423 3/27/2022
2.0.0 507 2/4/2022
1.1.0 731 12/4/2021
1.0.1 559 11/21/2021
1.0.0 308 11/8/2021
1.0.0-preview.4 120 11/6/2021
1.0.0-preview.3 139 11/1/2021
1.0.0-preview.2 118 10/26/2021
1.0.0-preview.1 112 10/26/2021