From 52b850092ce99eda56b45f41bcb63a9b542f2004 Mon Sep 17 00:00:00 2001 From: Konstantin Gross Date: Sun, 24 May 2020 02:52:27 +0200 Subject: [PATCH] Context menu example modified --- .../Controllers/MenusController.cs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/ElectronNET.WebApp/Controllers/MenusController.cs b/ElectronNET.WebApp/Controllers/MenusController.cs index b961554..ebf6a9b 100644 --- a/ElectronNET.WebApp/Controllers/MenusController.cs +++ b/ElectronNET.WebApp/Controllers/MenusController.cs @@ -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 },