コード例 #1
0
        public static bool Prompt(string question, string title)
        {
            ConfirmTimerResetWindow inst = new ConfirmTimerResetWindow(question, title);

            inst.ShowDialog();

            return(ConfirmReset);
        }
コード例 #2
0
ファイル: Task.xaml.cs プロジェクト: mikwod/TimeTracker-App
 private void startStopButton_Click(object sender, RoutedEventArgs e)
 {
     if (!this.dispatcherTimer.IsEnabled)
     {
         if (this.taskGrid.TaskIsRunning)
         {
             MessageBox.Show("'" + this.taskGrid.TaskNameRunning + "' is already started! Stop the task before starting a new task.", "Invalid Action", MessageBoxButton.OK);
             return;
         }
         if (this.TimeHasElapsed)
         {
             bool confirmReset = ConfirmTimerResetWindow.Prompt("Are you sure you wish to reset the timer?", "Alert!");
             if (!confirmReset)
             {
                 return;
             }
         }
         this.TimeText.Text            = startTime;
         this.dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
         this.dispatcherTimer.Interval = dispatcherInterval;
         this.dispatcherTimer.Start();
         this.stopWatch.Start();
         this.StartStopButton.Content    = "Stop";
         this.StartStopButton.Background = stopButtonColor;
         this.IsRunning = true;
     }
     else
     {
         this.dispatcherTimer.Stop();
         this.stopWatch.Stop();
         this.convertElapsedTimeToHours();
         this.stopWatch.Reset();
         this.StartStopButton.Content    = this.TimeText.Text != this.startTime ? "Time Recorded" : "Start";
         this.StartStopButton.Background = this.TimeText.Text != this.startTime ? startButtonColorWithTime : startButtonColor;
         this.IsRunning = false;
     }
 }