Fix logic of all windows closed event on macos

The application was not raising the all windows closed event which
didn't allow the .NET application to exit properly when the last window
was closed.

The recommendation by electronjs is to subscribe to the all windows
closed event and exit the app via code on macos.

This change allows the event to propagated up to the .NET application.

It may be better to move all of the logic surrounding this to the
ElectronNET.API project and allow the application developer full
control over the behavior.  For now, this fixes the immediate bug.

GH-346
This commit is contained in:
Dave Ferguson
2020-05-17 21:40:20 -04:00
parent 05de4071d1
commit 0573e92ed5
4 changed files with 25 additions and 14 deletions

View File

@@ -3,6 +3,7 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
@@ -31,7 +32,7 @@ namespace ElectronNET.API
{
BridgeConnector.Socket.On("app-window-all-closed" + GetHashCode(), () =>
{
if (!Electron.WindowManager.IsQuitOnWindowAllClosed)
if (!Electron.WindowManager.IsQuitOnWindowAllClosed || RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
_windowAllClosed();
}