mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-09-22 15:04:47 +00:00
add App.Ready event
This commit is contained in:
@@ -353,10 +353,28 @@ namespace ElectronNET.API
|
||||
|
||||
private event Action<bool> _accessibilitySupportChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when the application has finished basic startup.
|
||||
/// </summary>
|
||||
public event Action Ready;
|
||||
|
||||
/// <summary>
|
||||
/// Application host fully started.
|
||||
/// </summary>
|
||||
public bool IsReady { get; internal set; }
|
||||
public bool IsReady
|
||||
{
|
||||
get { return _isReady; }
|
||||
internal set
|
||||
{
|
||||
_isReady = value;
|
||||
|
||||
if(value)
|
||||
{
|
||||
Ready?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
private bool _isReady = false;
|
||||
|
||||
/// <summary>
|
||||
/// A property that indicates the current application's name, which is the
|
||||
|
||||
@@ -11,9 +11,13 @@ namespace ElectronNET.WebApp.Controllers
|
||||
{
|
||||
if (HybridSupport.IsElectronActive)
|
||||
{
|
||||
if (Electron.App.IsReady)
|
||||
if(Electron.App.IsReady)
|
||||
{
|
||||
CreateContextMenu();
|
||||
}
|
||||
else
|
||||
{
|
||||
Electron.App.Ready += () => CreateContextMenu();
|
||||
}
|
||||
|
||||
var menu = new MenuItem[] {
|
||||
|
||||
Reference in New Issue
Block a user