private async void EndShortBreak() { if (Configuration.SaveStats) { Configuration.ShortBreaksCompleted++; UpdateStats(); } UIViewModels.ShortLongBreakTimeRemaining.NextShortBreak = LocalizedEnvironment.Translation.EyesGuard.Waiting; UIViewModels.NotifyIcon.NextShortBreak = LocalizedEnvironment.Translation.EyesGuard.Waiting; await CurrentShortBreakWindow.HideUsingLinearAnimationAsync(); if (CurrentShortBreakWindow != null) { ((ShortBreakWindow)CurrentShortBreakWindow).LetItClose = true; CurrentShortBreakWindow.Close(); CurrentShortBreakWindow = null; } if (!App.Configuration.OnlyOneShortBreak && Configuration.ProtectionState == GuardStates.Protecting) { ShortBreakHandler.Start(); } LongBreakHandler.Start(); ShortDurationCounter.Stop(); UIViewModels.HeaderMenu.ManualBreakEnabled = true; }
public async void StartLongBreak() { ShortBreakHandler.Stop(); LongBreakHandler.Stop(); UIViewModels.HeaderMenu.ManualBreakEnabled = false; UIViewModels.ShortLongBreakTimeRemaining.NextLongBreak = LocalizedEnvironment.Translation.EyesGuard.Resting; UIViewModels.NotifyIcon.NextLongBreak = LocalizedEnvironment.Translation.EyesGuard.Resting; NextShortBreak = App.Configuration.ShortBreakGap; NextLongBreak = App.Configuration.LongBreakGap; var longWindow = new LongBreakWindow() { DataContext = UIViewModels.LongBreak }; LongBreakVisibleTime = App.Configuration.LongBreakDuration; UIViewModels.LongBreak.TimeRemaining = LocalizedEnvironment.Translation.EyesGuard.LongBreakTimeRemaining.FormatWith(new { LongBreakVisibleTime.Hours, LongBreakVisibleTime.Minutes, LongBreakVisibleTime.Seconds }); UIViewModels.LongBreak.CanCancel = (Configuration.ForceUserToBreak) ? Visibility.Collapsed : Visibility.Visible; if (CurrentShortBreakWindow != null) { ((ShortBreakWindow)CurrentShortBreakWindow).LetItClose = true; CurrentShortBreakWindow.Close(); CurrentShortBreakWindow = null; } ShortDurationCounter.Stop(); await longWindow.ShowUsingLinearAnimationAsync(); longWindow.Show(); longWindow.BringIntoView(); longWindow.Focus(); LongDurationCounter.Start(); }