コード例 #1
0
ファイル: ShutDownTimer.cs プロジェクト: PlumpMath/Shutdauwn
        private ShutDownTimer(Label statusLabel, DateTime shutdownDateTime, ShutdauwnForm shutdawunForm)
        {
            ShutDownTimer.instance = this;

            this.shutdownDateTime = shutdownDateTime;
            this.statusLabel      = statusLabel;
            this.timerRunning     = true;
            this.shutdawunForm    = shutdawunForm;

            this.timer();
        }
コード例 #2
0
        private ShutDownTimer(Label statusLabel, DateTime shutdownDateTime, ShutdauwnForm shutdawunForm)
        {
            ShutDownTimer.instance = this;

            this.shutdownDateTime = shutdownDateTime;
            this.statusLabel = statusLabel;
            this.timerRunning = true;
            this.shutdawunForm = shutdawunForm;

            this.timer();
        }
コード例 #3
0
ファイル: ShutdauwnForm.cs プロジェクト: PlumpMath/Shutdauwn
 private void timerButton_Click(object sender, EventArgs e)
 {
     if (ShutDownTimer.TimerStarted)
     {
         ShutDownTimer.StopTimer();
         this.timerButton.Text      = "Start shutdown timer";
         this.timerStatusLabel.Text = "";
     }
     else if (minutesUpDown.Value > 0 || hoursUpDown.Value > 0)
     {
         ShutDownTimer.StartTimer(this.timerStatusLabel, this, (int)this.minutesUpDown.Value, (int)this.hoursUpDown.Value);
         this.timerButton.Text = "Stop shutdown timer";
     }
 }
コード例 #4
0
ファイル: ShutDownTimer.cs プロジェクト: PlumpMath/Shutdauwn
 private void timer()
 {
     while (this.timerRunning)
     {
         if (DateTime.Now >= this.shutdownDateTime)
         {
             ShutDownTimer.setStatus(this.statusLabel, "Shutting down");
             this.shutdawunForm.Shutdown();
             return;
         }
         ShutDownTimer.setStatus(this.statusLabel, ShutDownTimer.getTimeLeftString(this.shutdownDateTime));
         Thread.Sleep(100);
     }
     ShutDownTimer.setStatus(this.statusLabel, "");
 }