PowerBindings 1.0.0

dotnet add package PowerBindings --version 1.0.0                
NuGet\Install-Package PowerBindings -Version 1.0.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="PowerBindings" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PowerBindings --version 1.0.0                
#r "nuget: PowerBindings, 1.0.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 PowerBindings as a Cake Addin
#addin nuget:?package=PowerBindings&version=1.0.0

// Install PowerBindings as a Cake Tool
#tool nuget:?package=PowerBindings&version=1.0.0                

C# Example: Key Press Binding

This is a simple example demonstrating how to bind a key press (A key) in C# using the ISingleFilterKeyTrait trait-interface.

How It Works

  • The BindAKeyExampleClass implements ISingleFilterKeyTrait.
  • It binds the A key to trigger an action when pressed.
  • When the A key is pressed, a message will be printed to the console.
  • Only one message at a time and also awaited until the next action triggers again

Code Example

Below is the full code snippet:

using System;
using System.Threading.Tasks;

public class Program
{
   public static void Main(string[] args)
   {
      ISingleFilterKeyTrait obj = new BindAKeyExampleClass();

      using var binding = obj.CreateBinding();

      Console.Read();
   }

   public sealed class BindAKeyExampleClass : ISingleFilterKeyTrait
   {
      public HookKey Key => new('A', HookKey.KeyTriggerType.KeyDown);

      public async ValueTask OnKeyPressed(HookKey key) =>
         await Console.Out.WriteLineAsync("This will be written when A is Pressed");
   }
}

Other behaviours

  • The library offers also some other behaviours to choose from like: ICancelFilterKeyTrait, IParallelFilterKeyTrait, ISerialFilterKeyTrait, ISingleFilterKeyTrait, ISwitchKeyTrait
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
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
1.0.0 101 12/10/2024