public async void BeginExecutedExtension() { CancelExecutedExtension(); newSession = new ExtendedExecutionSession(); newSession.Reason = ExtendedExecutionReason.Unspecified; newSession.Description = "Timer Pomodoro Tomato"; newSession.Revoked += NewSession_Revoked; ExtendedExecutionResult result = await newSession.RequestExtensionAsync(); switch (result) { case ExtendedExecutionResult.Allowed: tomato.Start(); break; case ExtendedExecutionResult.Denied: Notifier.GetInstance(Dispatcher).ShowMessageNotification(NotificationType.Error, false); CancelExecutedExtension(); tomato.Cancel(); var loader = new Windows.ApplicationModel.Resources.ResourceLoader(); ucStopNotice.ChangeMessage(loader.GetString("ToastInterrupt0/Text")); ShowStopNotice.Begin(); break; } }
private async void BtCancel_Click(object sender, RoutedEventArgs e) { await Dispatcher.RunAsync(CoreDispatcherPriority.High, () => { tomato.Cancel(); ShowStopNotice.Begin(); CancelExecutedExtension(); }); }
private async void Tomato_TimerStopEvent(object status) { await Dispatcher.RunAsync(CoreDispatcherPriority.High, () => { ShowStopNotice.Begin(); Notifier.GetInstance(Dispatcher).ShowMessageNotification(NotificationType.Finish, visible); CancelExecutedExtension(); }); }
private void NewSession_Revoked(object sender, ExtendedExecutionRevokedEventArgs args) { if (tomato.Status != TomatoStatus.Stop) { Notifier.GetInstance(Dispatcher).ShowMessageNotification(NotificationType.Error, visible); tomato.Cancel(); var loader = new Windows.ApplicationModel.Resources.ResourceLoader(); ucStopNotice.ChangeMessage(loader.GetString("ToastInterrupt0/Text")); ShowStopNotice.Begin(); } }
private async void InternetAbled() { await Dispatcher.RunAsync(CoreDispatcherPriority.High, () => { if (GridStopNotice.Opacity == 0) { CancelExecutedExtension(); tomato.Cancel(); var loader = new Windows.ApplicationModel.Resources.ResourceLoader(); ucStopNotice.ChangeMessage(loader.GetString("ToastInterrupt0/Text")); ShowStopNotice.Begin(); Notifier.GetInstance(Dispatcher).ShowMessageNotification(NotificationType.Interrupt, visible); } }); }