diff --git a/ElectronNET.API/App.cs b/ElectronNET.API/App.cs
index f87344a..9f4c717 100644
--- a/ElectronNET.API/App.cs
+++ b/ElectronNET.API/App.cs
@@ -356,7 +356,24 @@ namespace ElectronNET.API
///
/// Emitted when the application has finished basic startup.
///
- public event Action Ready;
+ public event Action Ready
+ {
+ add
+ {
+ if(IsReady)
+ {
+ value();
+ }
+
+ _ready += value;
+ }
+ remove
+ {
+ _ready -= value;
+ }
+ }
+
+ private event Action _ready;
///
/// Application host fully started.
@@ -370,7 +387,7 @@ namespace ElectronNET.API
if(value)
{
- Ready?.Invoke();
+ _ready?.Invoke();
}
}
}
diff --git a/ElectronNET.WebApp/Controllers/MenusController.cs b/ElectronNET.WebApp/Controllers/MenusController.cs
index 8add209..a279774 100644
--- a/ElectronNET.WebApp/Controllers/MenusController.cs
+++ b/ElectronNET.WebApp/Controllers/MenusController.cs
@@ -11,14 +11,7 @@ namespace ElectronNET.WebApp.Controllers
{
if (HybridSupport.IsElectronActive)
{
- if(Electron.App.IsReady)
- {
- CreateContextMenu();
- }
- else
- {
- Electron.App.Ready += () => CreateContextMenu();
- }
+ Electron.App.Ready += () => CreateContextMenu();
var menu = new MenuItem[] {
new MenuItem { Label = "Edit", Submenu = new MenuItem[] {