remove recreate behaviour from activate event on mac, and emit event to handler instead

This commit is contained in:
rafael-aero
2021-08-30 13:22:07 +02:00
parent 35b18a9501
commit bd45e23768
6 changed files with 55 additions and 27 deletions

View File

@@ -25,6 +25,41 @@ namespace ElectronNET.API
/// </summary>
public static bool SocketDebug { get; set; }
/// <summary>
/// Emitted when the user clicks on the dock on Mac
/// <para/>
/// </summary>
[SupportedOSPlatform("macos")]
public event Action Activate
{
add
{
if (_appActivate == null)
{
BridgeConnector.On("app-activate", () =>
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
_appActivate();
}
});
}
_appActivate += value;
}
remove
{
_appActivate -= value;
if (_appActivate == null)
{
BridgeConnector.Off("app-activate");
}
}
}
private event Action _appActivate;
/// <summary>
/// Emitted when all windows have been closed.
/// <para/>