Skip to content

Commit 0573e92

Browse files
committed
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
1 parent 05de407 commit 0573e92

File tree

4 files changed

+25
-14
lines changed

4 files changed

+25
-14
lines changed

ElectronNET.API/App.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Newtonsoft.Json.Linq;
44
using Newtonsoft.Json.Serialization;
55
using System;
6+
using System.Runtime.InteropServices;
67
using System.Threading;
78
using System.Threading.Tasks;
89

@@ -31,7 +32,7 @@ public event Action WindowAllClosed
3132
{
3233
BridgeConnector.Socket.On("app-window-all-closed" + GetHashCode(), () =>
3334
{
34-
if (!Electron.WindowManager.IsQuitOnWindowAllClosed)
35+
if (!Electron.WindowManager.IsQuitOnWindowAllClosed || RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
3536
{
3637
_windowAllClosed();
3738
}

ElectronNET.Host/api/app.js

Lines changed: 11 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)