2017-10-21 04:37:01 +02:00
|
|
|
|
using ElectronNET.API;
|
|
|
|
|
|
using ElectronNET.API.Entities;
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2017-11-10 02:12:13 +01:00
|
|
|
|
using System.Threading.Tasks;
|
2017-10-21 04:37:01 +02:00
|
|
|
|
|
|
|
|
|
|
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-21 04:37:01 +02:00
|
|
|
|
{
|
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-21 04:37:01 +02:00
|
|
|
|
|
2017-10-23 21:24:05 +02:00
|
|
|
|
await Electron.Dialog.ShowMessageBoxAsync(options);
|
|
|
|
|
|
});
|
2018-01-24 22:44:27 +01:00
|
|
|
|
Electron.App.WillQuit += arg => Task.Run(() => Electron.GlobalShortcut.UnregisterAll());
|
2017-10-23 21:24:05 +02:00
|
|
|
|
}
|
2017-10-21 04:37:01 +02:00
|
|
|
|
|
|
|
|
|
|
return View();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|