public KeyEventsDetector(ILogger <KeyEventsDetector> logger, HotKeysOptions hotKeysOptions)
 {
     _logger         = logger;
     _hotKeysOptions = hotKeysOptions;
     _proc           = HookCallback;
     _hookId         = SetHook(_proc);
 }
Exemple #2
0
 /// <summary>
 ///  Adds a HotKeys service to the specified Microsoft.Extensions.DependencyInjection.IServiceCollection.
 /// </summary>
 /// <param name="services">The Microsoft.Extensions.DependencyInjection.IServiceCollection to add the service to.</param>
 /// <param name="configure">An <see cref="System.Action"/> to configure the options for HotKeys service.</param>
 public static IServiceCollection AddHotKeys(this IServiceCollection services, Action <HotKeysOptions> configure)
 {
     return(services.AddScoped(serviceProvider =>
     {
         var options = new HotKeysOptions();
         configure?.Invoke(options);
         var jsRuntime = serviceProvider.GetRequiredService <IJSRuntime>();
         var logger = serviceProvider.GetRequiredService <ILogger <global::Toolbelt.Blazor.HotKeys.HotKeys> >();
         return new global::Toolbelt.Blazor.HotKeys.HotKeys(jsRuntime, options, logger);
     }));
 }
 protected MenuItemPresenterBase(KeyPusherEngine engine, ContextMenuStrip mainMenu, HotKeysOptions hotkeys)
 {
     _engine   = engine;
     _mainMenu = mainMenu;
 }
 public ActivateMenuItem(KeyPusherEngine engine, ContextMenuStrip mainMenu, HotKeysOptions hotkeys, ILogger <ActivateMenuItem> logger) : base(engine, mainMenu, hotkeys, logger)
 {
     HotKeyCode = hotkeys.TurnHookOnOff;
 }
 public ExitMenuItem(KeyPusherEngine engine, ContextMenuStrip mainMenu, HotKeysOptions hotkeys, ILogger <ExitMenuItem> logger) : base(engine, mainMenu, hotkeys, logger)
 {
 }