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

30 lines
899 B
C#
Raw Normal View History

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