d1e71f0323
- Restore default FormBorderStyle (resizable with min/max/close buttons) - Minimize button hides to tray (WindowState=Minimized -> Hide()) - Close button and tray Exit both call Shutdown() then close normally - Tray Show/DoubleClick restores window from tray
42 lines
992 B
C#
42 lines
992 B
C#
namespace gatuna_client;
|
|
|
|
static class Program
|
|
{
|
|
[STAThread]
|
|
static void Main()
|
|
{
|
|
ApplicationConfiguration.Initialize();
|
|
|
|
var form = new MainForm();
|
|
|
|
using var tray = new NotifyIcon
|
|
{
|
|
Icon = SystemIcons.Application,
|
|
Text = "gatuna",
|
|
Visible = true,
|
|
};
|
|
|
|
tray.ContextMenuStrip = new ContextMenuStrip();
|
|
tray.ContextMenuStrip.Items.Add("Show", null, (_, _) =>
|
|
{
|
|
form.Show();
|
|
form.WindowState = FormWindowState.Normal;
|
|
form.Activate();
|
|
});
|
|
tray.ContextMenuStrip.Items.Add("-");
|
|
tray.ContextMenuStrip.Items.Add("Exit", null, (_, _) =>
|
|
{
|
|
tray.Visible = false;
|
|
form.Close();
|
|
});
|
|
tray.DoubleClick += (_, _) =>
|
|
{
|
|
form.Show();
|
|
form.WindowState = FormWindowState.Normal;
|
|
form.Activate();
|
|
};
|
|
|
|
Application.Run(form);
|
|
}
|
|
}
|