From 37ae869dcbd637e250ab0758e1a914dc7d7ea87d Mon Sep 17 00:00:00 2001 From: Fre Date: Fri, 12 Jun 2020 13:32:26 +0200 Subject: [PATCH 1/4] HostHook CallAsync --- ElectronNET.API/HostHook.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ElectronNET.API/HostHook.cs b/ElectronNET.API/HostHook.cs index 9618edb..3760625 100644 --- a/ElectronNET.API/HostHook.cs +++ b/ElectronNET.API/HostHook.cs @@ -72,13 +72,14 @@ namespace ElectronNET.API { BridgeConnector.Socket.Off(socketEventName + "Error" + guid); Electron.Dialog.ShowErrorBox("Host Hook Exception", result.ToString()); + taskCompletionSource.SetException(new Exception($"Host Hook Exception {result}")); }); BridgeConnector.Socket.On(socketEventName + "Complete" + guid, (result) => { BridgeConnector.Socket.Off(socketEventName + "Error" + guid); BridgeConnector.Socket.Off(socketEventName + "Complete" + guid); - T data; + T data = default; try { @@ -105,7 +106,8 @@ namespace ElectronNET.API } catch (Exception exception) { - throw new InvalidCastException("Return value does not match with the generic type.", exception); + taskCompletionSource.SetException(exception); + //throw new InvalidCastException("Return value does not match with the generic type.", exception); } taskCompletionSource.SetResult(data); From 8f92d3986fe39f1a6cf4ae8e001cfa25a7843aff Mon Sep 17 00:00:00 2001 From: Robert Muehsig Date: Fri, 12 Jun 2020 23:27:53 +0200 Subject: [PATCH 2/4] 9.31.1 --- Changelog.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 2fba31a..6868d72 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,7 @@ # Not released +# Released + # 9.31.1 ElectronNET.CLI: @@ -32,8 +34,6 @@ ElectronNET.WebApp (internal use): Thank you for donation [Phil Seeman](https://github.com/mpnow) ❤ -# Released - # 8.31.2 ElectronNET.CLI: From de1637672aa74571feb17090bb3edd6f3667ba63 Mon Sep 17 00:00:00 2001 From: Writwick Das Date: Mon, 15 Jun 2020 17:01:31 +0200 Subject: [PATCH 3/4] enabled empty tray icon (fixes click event on macos) --- ElectronNET.API/Tray.cs | 9 +++++++++ ElectronNET.Host/api/tray.js | 14 +++++++++----- ElectronNET.Host/api/tray.ts | 16 +++++++++------- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/ElectronNET.API/Tray.cs b/ElectronNET.API/Tray.cs index 2781a1f..76705a4 100644 --- a/ElectronNET.API/Tray.cs +++ b/ElectronNET.API/Tray.cs @@ -263,6 +263,15 @@ namespace ElectronNET.API }); } + /// + /// Shows the Traybar (empty). + /// + /// The image. + public void Show(string image) + { + BridgeConnector.Socket.Emit("create-tray", image); + } + /// /// Destroys the tray icon immediately. /// diff --git a/ElectronNET.Host/api/tray.js b/ElectronNET.Host/api/tray.js index 6ed7e14..77b3030 100644 --- a/ElectronNET.Host/api/tray.js +++ b/ElectronNET.Host/api/tray.js @@ -47,13 +47,17 @@ module.exports = (socket) => { } }); socket.on('create-tray', (image, menuItems) => { - const menu = electron_1.Menu.buildFromTemplate(menuItems); - addMenuItemClickConnector(menu.items, (id) => { - electronSocket.emit('trayMenuItemClicked', id); - }); const trayIcon = electron_1.nativeImage.createFromPath(image); tray = new electron_1.Tray(trayIcon); - tray.setContextMenu(menu); + + if (menuItems) { + const menu = electron_1.Menu.buildFromTemplate(menuItems); + addMenuItemClickConnector(menu.items, (id) => { + electronSocket.emit('trayMenuItemClicked', id); + }); + + tray.setContextMenu(menu); + } }); socket.on('tray-destroy', () => { if (tray) { diff --git a/ElectronNET.Host/api/tray.ts b/ElectronNET.Host/api/tray.ts index e7e8ef5..3fa8d94 100644 --- a/ElectronNET.Host/api/tray.ts +++ b/ElectronNET.Host/api/tray.ts @@ -53,16 +53,18 @@ export = (socket: SocketIO.Socket) => { }); socket.on('create-tray', (image, menuItems) => { - const menu = Menu.buildFromTemplate(menuItems); - - addMenuItemClickConnector(menu.items, (id) => { - electronSocket.emit('trayMenuItemClicked', id); - }); - const trayIcon = nativeImage.createFromPath(image); tray = new Tray(trayIcon); - tray.setContextMenu(menu); + + if (menuItems) { + const menu = Menu.buildFromTemplate(menuItems); + + addMenuItemClickConnector(menu.items, (id) => { + electronSocket.emit('trayMenuItemClicked', id); + }); + tray.setContextMenu(menu); + } }); socket.on('tray-destroy', () => { From 15ce35a7d95df4b01908d7e328ee8145849804ee Mon Sep 17 00:00:00 2001 From: Bob Baker <31376573+rbaker26@users.noreply.github.com> Date: Fri, 3 Jul 2020 23:19:19 -0700 Subject: [PATCH 4/4] removed extra . cause build failures --- ElectronNET.CLI/Commands/BuildCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ElectronNET.CLI/Commands/BuildCommand.cs b/ElectronNET.CLI/Commands/BuildCommand.cs index 2075b70..748348a 100644 --- a/ElectronNET.CLI/Commands/BuildCommand.cs +++ b/ElectronNET.CLI/Commands/BuildCommand.cs @@ -186,7 +186,7 @@ namespace ElectronNET.CLI.Commands ProcessHelper.CmdExecute($"node build-helper.js " + manifestFileName, tempPath); Console.WriteLine($"Package Electron App for Platform {platformInfo.ElectronPackerPlatform}..."); - ProcessHelper.CmdExecute($"npx electron-builder . --config=./bin/electron-builder.json --{platformInfo.ElectronPackerPlatform} --{electronArch} -c.electronVersion=9.0.3 {electronParams}", tempPath); + ProcessHelper.CmdExecute($"npx electron-builder --config=./bin/electron-builder.json --{platformInfo.ElectronPackerPlatform} --{electronArch} -c.electronVersion=9.0.3 {electronParams}", tempPath); Console.WriteLine("... done");