mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-04-29 01:22:00 +00:00
Context menu example modified
This commit is contained in:
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user