Detecta el reinicio de windows y se cierra sin pedir confirmacion

This commit is contained in:
Ernesto Abarca Ortiz 2018-08-08 10:00:21 +02:00
parent 828315fd94
commit 45d5aca358
1 changed files with 12 additions and 2 deletions

View File

@ -134,8 +134,18 @@ namespace LectorVerdnatura
private void Salir_Click(object sender, EventArgs e)
{
this.notifyIcon1.Visible = false;
this.Dispose();
if (!systemShutdown)
{
// Reset the variable because the user might cancel the shutdown.
systemShutdown = false;
DialogResult respuesta = MessageBox.Show("La aplicacion debe estar en marcha para recoger los fichajes!" + Environment.NewLine + "¿ Esta seguro de que desea cerrar la aplicacion ?", "Confirmacion", MessageBoxButtons.YesNo);
if (respuesta == DialogResult.Yes)
{
this.notifyIcon1.Visible = false;
Application.Exit();
}
}
}
private void timer1_Tick(object sender, EventArgs e)