mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-12 19:57:33 +00:00
Convert main static references off of Electron into interface implementation and expose the underlying Socket for low level interaction.
This commit is contained in:
39
ElectronNET.API/Interfaces/IGlobalShortcut.cs
Executable file
39
ElectronNET.API/Interfaces/IGlobalShortcut.cs
Executable file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ElectronNET.API.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Detect keyboard events when the application does not have keyboard focus.
|
||||
/// </summary>
|
||||
public interface IGlobalShortcut
|
||||
{
|
||||
/// <summary>
|
||||
/// Registers a global shortcut of accelerator.
|
||||
/// The callback is called when the registered shortcut is pressed by the user.
|
||||
///
|
||||
/// When the accelerator is already taken by other applications, this call will
|
||||
/// silently fail.This behavior is intended by operating systems, since they don’t
|
||||
/// want applications to fight for global shortcuts.
|
||||
/// </summary>
|
||||
void Register(string accelerator, Action function);
|
||||
|
||||
/// <summary>
|
||||
/// When the accelerator is already taken by other applications,
|
||||
/// this call will still return false. This behavior is intended by operating systems,
|
||||
/// since they don’t want applications to fight for global shortcuts.
|
||||
/// </summary>
|
||||
/// <returns>Whether this application has registered accelerator.</returns>
|
||||
Task<bool> IsRegisteredAsync(string accelerator);
|
||||
|
||||
/// <summary>
|
||||
/// Unregisters the global shortcut of accelerator.
|
||||
/// </summary>
|
||||
void Unregister(string accelerator);
|
||||
|
||||
/// <summary>
|
||||
/// Unregisters all of the global shortcuts.
|
||||
/// </summary>
|
||||
void UnregisterAll();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user