Files
Electron.NET/ElectronNET.WebApp/Controllers/ShortcutsController.cs

26 lines
771 B
C#

using ElectronNET.API;
using ElectronNET.API.Entities;
using Microsoft.AspNetCore.Mvc;
namespace ElectronNET.WebApp.Controllers
{
public class ShortcutsController : Controller
{
public IActionResult Index()
{
Electron.GlobalShortcut.Register("CommandOrControl+Alt+K", async () => {
var options = new MessageBoxOptions("You pressed the registered global shortcut keybinding.")
{
Type = MessageBoxType.info,
Title = "Success!"
};
await Electron.Dialog.ShowMessageBoxAsync(options);
});
Electron.App.WillQuit += () => Electron.GlobalShortcut.UnregisterAll();
return View();
}
}
}