Skip to content

BrowserWindow OnClose event  #391

Closed
Closed
@AykutToprak

Description

@AykutToprak

🚨 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.");
}

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions