Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
        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();
            }
        }