private void Shutdown() { if (CanShutdown) { ShutdownTimer.Enabled = true; ShutdownNotification shut = new ShutdownNotification {ShutdownType = GetShutdownType()}; switch (shut.ShowDialog(this)) { case DialogResult.Cancel: ShutdownTimer.Enabled = false; MessageBox.Show(GetShutdownType() + " aborted!"); break; case DialogResult.Yes: if (GetShutdownType() == "Standby" || GetShutdownType() == "Hibernate") { shut.Close(); shut.Dispose(); ShutdownTimer.Enabled = false; } break; } ShutdownComputer(); } }
private void Shutdown() { if (CanShutdown) { ShutdownTimer.Enabled = true; ShutdownTimer.Start(); ShutdownNotification shut = new ShutdownNotification { ShutdownType = GetShutdownType() }; switch (shut.ShowDialog(this)) { case DialogResult.Cancel: ShutdownTimer.Stop(); ShutdownTimer.Enabled = false; MessageBox.Show(GetShutdownType() + " aborted!"); return; case DialogResult.OK: ShutdownComputer(); break; } } }
private void CanShutdown() { if (chkShutdown.Checked && listMaker.Count == 0) { ShutdownTimer.Enabled = true; ShutdownNotification shut = new ShutdownNotification(); shut.ShutdownType = GetShutdownType(); DialogResult result = shut.ShowDialog(this); if (result == DialogResult.Cancel) { ShutdownTimer.Enabled = false; MessageBox.Show(GetShutdownType() + " aborted!"); } else if (result == DialogResult.Yes) if (GetShutdownType() == "Standby" || GetShutdownType() == "Hibernate") { shut.Close(); shut.Dispose(); ShutdownTimer.Enabled = false; } ShutdownComputer(); } }