I am using Blazor Server. Inside my startup I am configuring the MenuItems like this:
var menu = new[]
{
new MenuItem
{
Label = "File", Submenu = new[]
{
new MenuItem
{
Label = "Save",
Accelerator = "CmdOrCtrl+S",
Enabled = false,
Click = () =>
{
// How do I execute code inside my component?
},
}
}
}
};
Electron.Menu.SetApplicationMenu(menu);
My component lives on the root and is always rendered. It has a simple method called Save which I want to call.
public async Task SaveProject()
{
await Project.Save();
}
Isn't there some kind of event inside the static Electron class that I could use? Something like OnMenuItemClicked.
Having a static property that I could access inside my component would not only be bad design, it would prevent me from accessing any instance properties.