Files
Electron.NET/ElectronNET.WebApp/Controllers/ShortcutsController.cs
Robert Muehsig e4d03eed39 build fix
2018-01-24 22:44:27 +01:00

30 lines
945 B
C#

using ElectronNET.API;
using ElectronNET.API.Entities;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
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 += arg => Task.Run(() => Electron.GlobalShortcut.UnregisterAll());
}
return View();
}
}
}