Torna al Thread
private void Form1_FormClosing(object sender, System.ComponentModel.CancelEventArgs e)// chiusura
{
DialogResult result =MessageBox.Show("Sì -> Chiude l'applicazione" + "\r\nNo -> Riduce nella traybar","", MessageBoxButtons.YesNo);
if (result == DialogResult.No)
{
e.Cancel = true;
notifyIcon1.Visible = true;
//this.Hide();
this.ShowInTaskbar = false;
this.Visible = false;
//this.Activate();
}
}
private void notifyIcon1_DoubleClick(object Sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.WindowState = FormWindowState.Normal;
this.ShowInTaskbar = true;
notifyIcon1.Visible = false;
}
// Activate the form.
this.Activate();
}