mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-08 21:26:52 +00:00
30 lines
945 B
C#
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();
|
|
}
|
|
}
|
|
} |