示例#1
0
        private void shutdownNowBtn_Click(object sender, EventArgs e)
        {
            var result = MessageBox.Show(
                "本当にシャットダウンして良いですか。\n保存されていないデータは失われます。",
                "確認",
                MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

            if (result == DialogResult.Yes)
            {
                Win32Shutdown.Shutdown();
            }
        }
示例#2
0
        private void timer_Tick(object sender, EventArgs e)
        {
            if (this.Visible)
            {
                timeRemainingLabel.Text = this.Model.TimeRemaining().ToString(@"hh\:mm\:ss");
                if (this.Model.IsInWarningPhase())
                {
                    StartWarningPhase();
                }
            }
            else
            {
                if (this.Model.IsInWarningPhase())
                {
                    this.Visible = true;
                }
            }

            if (this.Model.IsInShutdownPhase())
            {
                Win32Shutdown.Shutdown();
            }
        }