Tray click event not fired, BalloonClosed event only called once
- Version: 11.5.1
- Node: v14.17.1
- .NET Core: 5.0
- Target: Windows 10
Steps to Reproduce:
- Download sample project and run it
- Attach debugger to TraySampleElectronNet.exe
- Navigate to TrayHelper.cs and place breakpoint on lines 45 and 51
- In the app click "Hide to tray" then click on the icon in the tray, breakpoint is not hit
- Click "Show tray notification", closing the toast notification causes breakpoint to hit, repeat, the breakpoint no longer being hit
Tray context menu items work fine TraySampleElectronNet.zip
OnDoubleClick event can not be fired neither.
- Version: 13.5.1
- .Net: 5.0
- Target: Win10
- Sample code:
Electron.Tray.OnDoubleClick += (args, rect) => { Console.WriteLine("Electron.Tray.OnDoubleClick"); RestoreFromTray(); }; Electron.Tray.Show(iconPath, menuItems);
🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉
With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!
@GregorBiswanger still nor Electron.Tray.OnClick or Electron.Tray.OnDoubleClick does fire an event.
Electron.CLI 23.6.1.
How can I help to reproduce?
The interesting part is that you have to first call Show method, ONLY THEN AFTER YOU CAN SUBSCRIBE TO TRAY EVENTS!
Thx to this beautiful if statement in the native implementation.
and
So that is why this fails
Electron.Tray.OnClick += OnTrayIconClick;
Electron.Tray.Show(iconPath, menuItems);
BUT NOT THIS
Electron.Tray.Show(iconPath, menuItems);
Electron.Tray.OnClick += OnTrayIconClick;