コード例 #1
0
        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;
            }
        }
コード例 #2
0
 private async void BtCancel_Click(object sender, RoutedEventArgs e)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
     {
         tomato.Cancel();
         ShowStopNotice.Begin();
         CancelExecutedExtension();
     });
 }
コード例 #3
0
        private async void Tomato_TimerStopEvent(object status)
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
            {
                ShowStopNotice.Begin();
                Notifier.GetInstance(Dispatcher).ShowMessageNotification(NotificationType.Finish, visible);

                CancelExecutedExtension();
            });
        }
コード例 #4
0
        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();
            }
        }
コード例 #5
0
        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);
                }
            });
        }