Files
Electron.NET/ElectronNET.WebApp/Controllers/ShortcutsController.cs
2017-10-23 21:24:05 +02:00

30 lines
899 B
C#

using ElectronNET.API;
using ElectronNET.API.Entities;
using Microsoft.AspNetCore.Mvc;
namespace ElectronNET.WebApp.Controllers
{
public class ShortcutsController : Controller
{
public IActionResult Index()
{
if (HybridSupport.IsElectronActive)
{
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();
}
}
}