Context menu example modified

This commit is contained in:
Konstantin Gross
2020-05-24 02:52:27 +02:00
parent cac9cfcec8
commit 52b850092c

View File

@@ -2,27 +2,20 @@
using Microsoft.AspNetCore.Mvc;
using ElectronNET.API.Entities;
using ElectronNET.API;
using Microsoft.Extensions.Hosting;
namespace ElectronNET.WebApp.Controllers
{
public class MenusController : Controller
{
public MenusController(IHostApplicationLifetime hostApplicationLifetime)
{
hostApplicationLifetime.ApplicationStarted.Register(() =>
{
if (HybridSupport.IsElectronActive)
{
CreateContextMenu();
}
});
}
public IActionResult Index()
{
if (HybridSupport.IsElectronActive)
{
if (Electron.App.IsReady)
{
CreateContextMenu();
}
var menu = new MenuItem[] {
new MenuItem { Label = "Edit", Submenu = new MenuItem[] {
new MenuItem { Label = "Undo", Accelerator = "CmdOrCtrl+Z", Role = MenuRole.undo },