BrowserWindow OnClose event
See original GitHub issue🚨 The issue tracker is not for questions 🚨
How to hide browser window and put application in Tray mode on close button clicked?
I tried as it shown below;
browserWindow.OnClose += () => OnClose(browserWindow);
and OnClose action;
private static void OnClose(BrowserWindow browserWindow)
{
browserWindow.Hide();
var menu = new MenuItem[]
{
new MenuItem
{
Label = "Show",
Click = () =>
{
Electron.Tray.Destroy();
browserWindow.Show();
}
},
new MenuItem
{
Label = "Quit",
Click = () => Electron.App.Quit()
}
};
Electron.Tray.Show("favicon.ico", menu);
Electron.Tray.SetToolTip("Electron Demo in the tray.");
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to catch the event of clicking the app window's close ...
You can catch it by using the close event of the browser-window api. You can try the following to verify this... var app...
Read more >BrowserWindow
Calling event.preventDefault() will cancel the close. Usually you would want to use the beforeunload handler to decide whether the window should be closed, ......
Read more >electron.BrowserWindow.close JavaScript and Node.js ...
How to use. close. function. in. BrowserWindow. Best JavaScript code snippets using electron.BrowserWindow.close(Showing top 15 results out of 315).
Read more >Two ways to react on the Electron 'close' event
The BrowserWindow emits events when an App Command is invoked. The ones we are interested in are 'close' and 'resize'.
Read more >Adding a Shutdown Dialog to Electron - NetworkSynapse
Electron's BrowserWindow 'close' event is perfect, as it is triggered anytime a user closes the Main Window. It is triggered with a hotkey,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To piggyback on this problem.
In js you can do something like this in your app.js
I noticed the OnClose do not hand over any arguments to do the same in c#. Is this a missing feature?
Thank you @GregorBiswanger .
It solved the problem.