Esempio n. 1
0
        private void TimerPowerOff_Tick(object sender, EventArgs e)
        {
            DateTime NowTime = DateTime.Now;

            if (NudHour.Value == NowTime.Hour && NudMinute.Value == NowTime.Minute)
            {
                TimerPowerOff.Stop();
                ShutDown();
                MessageBox.Show("正在准备关机...", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                //TimerPowerOff2.Start();
                return;
            }
        }
Esempio n. 2
0
        //=============================倒计时================================



        //=============================定时关机===============================

        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (rbNoPowerOff.Checked)
            {
                TimerPowerOff.Stop();//关闭关机计时器
                MessageBox.Show("设置成功,不定时关机", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.pbGou.Location = new System.Drawing.Point(20, 90);
                return;
            }
            else if (rbPowerOffTime.Checked)
            {
                if (NudHour.Value == DateTime.Now.Hour && NudMinute.Value - DateTime.Now.Minute <= 1)
                {
                    MessageBox.Show("关机时间至少必须提前2分钟", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                MessageBox.Show("设置成功,关机时间为:" + NudHour.Value + "时" + NudMinute.Value + "分", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TimerPowerOff.Start();//启动关机计时器
                this.pbGou.Location = new System.Drawing.Point(20, 25);
                return;
            }
        }