private void PauseItem_Click(object sender, RoutedEventArgs e) { if (pauseWindow == null) { pauseWindow = new PauseWindow(); pauseWindow.Closed += PauseWindow_Closed; } else { pauseWindow.Activate(); } pauseTotalLength = TimeSpan.FromMinutes(pauseWindow.ShowDialog()); isPaused = true; // If the user chose timed pause if (pauseTotalLength.TotalSeconds > 0) { // Zero out the counter to know how long the pause should be going on TimerHandler.ResetCounterTime(ref pauseLengthSoFar); ActivateResumeBtn(); SetTaskbarTooltip(TimeToPauseEnd() + TOOLTIP_PAUSE_MSG); PauseTimers(true); } // if this is going on till resume is pushed else if (pauseTotalLength.TotalMinutes.Equals(TimeSpan.FromMinutes(-1))) { ActivateResumeBtn(); SetTaskbarTooltip(TOOLTIP_INDEF_PAUSE); PauseTimers(false); } // Or the user just canceled else { isPaused = false; } }
private void PauseWindow_Closed(object sender, EventArgs e) { pauseWindow = null; }