コード例 #1
0
 private void tmCountDown_Tick(object sender, EventArgs e)
 {
     if (countDownStart)
     {
         this.lbCountDown.Text = "将在" + this.countDownNumber + "s后关机...";
         if (this.countDownNumber == 180)
         {
             CMDManager.shutDown(180);
         }
         this.countDownNumber--;
         if (this.countDownNumber == 0)
         {
             this.countDownNumber     = 180;
             this.tmCountDown.Enabled = false;
             this.Hide();
         }
     }
     else
     {
         if (DateTime.Now.ToShortTimeString().ToString().Equals("08:45") || DateTime.Now.ToShortTimeString().ToString().Equals("18:00"))
         {
             this.countDownStart = true;
             this.Show();
         }
     }
 }
コード例 #2
0
 private void btnYes_Click(object sender, EventArgs e)
 {
     if (this.yesIndex == this.yesArray.Length)
     {
         CMDManager.repealShutDown();
         System.Environment.Exit(0);
     }
     MessageBox.Show(this.yesArray[this.yesIndex], "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     this.yesIndex++;
 }
コード例 #3
0
 public static void repealShutDown()
 {
     CMDManager.command("shutdown -a");
 }
コード例 #4
0
 public static void shutDown(int time)
 {
     CMDManager.command("shutdown -s -t " + time);
 }