コード例 #1
0
        private async void SessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            System.Diagnostics.Debug.WriteLine($"Extended execution session was revoked reaseon: {args.Reason}");
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                ExecutionContext.Instance.IsPaused = true;
            });

            _pauseTokenSource.IsPaused = true;
            ToastHelper.SendToast(App.ResourceLoader.GetString("SyncWasPaused"));
            ClearExecutionSession(_executionSession);
        }
コード例 #2
0
 private static void ExtendedExecutionSession_Revoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     try
     {
         if (session != null)
         {
             session.Dispose();
             session = null;
         }
     }
     catch { }
 }
コード例 #3
0
        /// <summary>
        /// Handles event when an extended execution session is revoked.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="args">The event argument.</param>
        private async void SessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            await this.gpxHandler.RecordCommentAsync(this.trackingId, "Extended session revoked");

            switch (args.Reason)
            {
            case ExtendedExecutionRevokedReason.Resumed:
                // The app returns to the foreground.
                await this.StartExtendedExecution();

                break;
            }
        }
コード例 #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();
            }
        }
        private async void ExtendedExecutionSessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                switch (args.Reason)
                {
                case ExtendedExecutionRevokedReason.Resumed:
                    rootPage.NotifyUser("Extended execution revoked due to returning to foreground.", NotifyType.StatusMessage);
                    break;

                case ExtendedExecutionRevokedReason.SystemPolicy:
                    rootPage.NotifyUser("Extended execution revoked due to system policy.", NotifyType.StatusMessage);
                    break;
                }
            });
        }
        private async void ExtendedExecutionSessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                switch (args.Reason)
                {
                    case ExtendedExecutionRevokedReason.Resumed:
                        rootPage.NotifyUser("Extended execution revoked due to returning to foreground.", NotifyType.StatusMessage);
                        break;

                    case ExtendedExecutionRevokedReason.SystemPolicy:
                        rootPage.NotifyUser("Extended execution revoked due to system policy.", NotifyType.StatusMessage);
                        break;
                }
            });
        }
コード例 #7
0
        private async void SessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                switch (args.Reason)
                {
                case ExtendedExecutionRevokedReason.Resumed:
                    break;

                case ExtendedExecutionRevokedReason.SystemPolicy:
                    break;
                }

                EndExtendedExecution();
            });
        }
コード例 #8
0
        private async void SessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            //session被系统回收时记录原因,session被回收则无法保持后台运行
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                switch (args.Reason)
                {
                case ExtendedExecutionRevokedReason.Resumed:
                    Console.WriteLine("Extended execution revoked due to returning to foreground.");
                    break;

                case ExtendedExecutionRevokedReason.SystemPolicy:
                    Console.WriteLine("Extended execution revoked due to system policy.");
                    break;
                }
            });
        }
コード例 #9
0
        private async void SessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                switch (args.Reason)
                {
                case ExtendedExecutionRevokedReason.Resumed:
                    break;

                case ExtendedExecutionRevokedReason.SystemPolicy:
                    break;
                }

                EndExtendedExecution();
                BeginExtendedExecution();
            });
        }
コード例 #10
0
 /// <summary>Fired when Windows decides to kill a session.</summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private async void ExtendedExecutionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     KillExtendedExecutionSession(); // Null it.
     if (args.Reason == ExtendedExecutionRevokedReason.Resumed)
     {
         if (_extendedExecutionSession == null)
         {
             await StartExtendedSession();
         }
     }
     else if (args.Reason == ExtendedExecutionRevokedReason.SystemPolicy)
     {
         // SystemPolicy could mean:
         // a. The app was closed by the user.
         // b. The app was terminated for system resources.
         // c. Something undocumented.
     }
 }
コード例 #11
0
        private async void PusherEventReceptionSessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                switch (args.Reason)
                {
                case ExtendedExecutionRevokedReason.Resumed:
                    Debug.WriteLine("Extended execution revoked due to returning to foreground");
                    break;

                case ExtendedExecutionRevokedReason.SystemPolicy:
                    Debug.WriteLine("Extended execution revoked due to system policy");
                    break;
                }

                EndPusherEventReceptionSession();
            });
        }
コード例 #12
0
        private async void SessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
            {
                switch (args.Reason)
                {
                case ExtendedExecutionRevokedReason.Resumed:
                    break;

                case ExtendedExecutionRevokedReason.SystemPolicy:
                    Acr.UserDialogs.UserDialogs.Instance.Alert("Extended execution revoked due to system policy.",
                                                               "Background Execution revoked.", "OK");
                    break;
                }

                ClearExtendedExecution();
                await BeginExtendedExecution();
            });
        }
コード例 #13
0
        private void ExtendedExecutionSessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            //If session is revoked, make the OnSuspending event handler stop or the application will be terminated
            //if (cancellationTokenSource != null) { cancellationTokenSource.Cancel(); }

            switch (args.Reason)
            {
            case ExtendedExecutionRevokedReason.Resumed:
                // A resumed app has returned to the foreground
                _logHelper.Log(LogLevel.Error, $"Extended execution revoked due to returning to foreground.");
                break;

            case ExtendedExecutionRevokedReason.SystemPolicy:
                //An app can be in the foreground or background when a revocation due to system policy occurs
                _logHelper.Log(LogLevel.Error, $"Extended execution revoked due to system policy.");
                break;
            }

            suspendDeferral?.Complete();
            suspendDeferral = null;
        }
コード例 #14
0
        private async void ExtendedExecutionSession_RevokedAsync(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                switch (args.Reason)
                {
                case ExtendedExecutionRevokedReason.Resumed:
                    MetroEventSource.ToastAsync("Extended execution revoked due to returning to foreground.");
                    BeginExtendedExecution();
                    break;

                case ExtendedExecutionRevokedReason.SystemPolicy:
                    MetroEventSource.ToastAsync("Extended execution revoked due to system policy.");
                    ClearExtendedExecution();
                    break;

                default:
                    ClearExtendedExecution();
                    break;
                }
            });
        }
コード例 #15
0
        private async void SessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            //session被系统回收时记录原因,session被回收则无法保持后台运行
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                switch (args.Reason)
                {
                case ExtendedExecutionRevokedReason.Resumed:
                    Debug.WriteLine("Extended execution revoked due to returning to foreground.");
                    break;

                case ExtendedExecutionRevokedReason.SystemPolicy:
                    Debug.WriteLine("Extended execution revoked due to system policy.");
                    string title   = "Pixiv Wallpaper for Windows 10后台活动被系统关闭";
                    string content = "系统回收了应用的会话资源,应用程序在后台时将会被挂起无法继续运行。" +
                                     "若希望使此应用在后台活动,请尝试插入外部电源或更改电源设置允许应用运行后台任务";
                    ToastManagement tm = new ToastManagement(title, content, ToastManagement.ExtendedRevoked);
                    tm.ToastPush(120);
                    break;
                }
            });
        }
コード例 #16
0
        private async void SessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            Debug.WriteLine("SessionRevoked");

//            await CoreDispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            //{
            switch (args.Reason)
            {
            case ExtendedExecutionRevokedReason.Resumed:
                //rootPage.NotifyUser("Extended execution revoked due to returning to foreground.", NotifyType.StatusMessage);
                Debug.WriteLine("Extended execution revoked due to returning to foreground.");
                break;

            case ExtendedExecutionRevokedReason.SystemPolicy:
                //rootPage.NotifyUser("Extended execution revoked due to system policy.", NotifyType.StatusMessage);
                Debug.WriteLine("Extended execution revoked due to system policy.");
                break;
            }

            EndExtendedExecution();
            //});
        }
コード例 #17
0
 private static void _extendedExecutionSession_Revoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     _isStarted = false;
     _isRevoked = true;
 }
コード例 #18
0
 private void SessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     ExtendedExecutionAllowed = false;
 }
コード例 #19
0
 private void Session_Revoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     //StopLocationExtensionSession();
     StartLocationExtensionSession();
 }
コード例 #20
0
 private void Session_Revoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     OutputDebugString("edetocCCTSample_Tracing:   ExtendedExecution revoked");
 }
コード例 #21
0
 private static void HandleRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     s_isStarted = false;
     s_isRevoked = true;
 }
        private async void ExtendedExecutionSessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            //If session is revoked, make the OnSuspending event handler stop or the application will be terminated
            if (cancellationTokenSource != null){ cancellationTokenSource.Cancel(); }

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                switch (args.Reason)
                {
                    case ExtendedExecutionRevokedReason.Resumed:
                        // A resumed app has returned to the foreground
                        rootPage.NotifyUser("Extended execution revoked due to returning to foreground.", NotifyType.StatusMessage);
                        break;

                    case ExtendedExecutionRevokedReason.SystemPolicy:
                        //An app can be in the foreground or background when a revocation due to system policy occurs
                        MainPage.DisplayToast("Extended execution revoked due to system policy.");
                        rootPage.NotifyUser("Extended execution revoked due to system policy.", NotifyType.StatusMessage);
                        break;
                }
            });
        }
コード例 #23
0
 private void Session_Revoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     //throw new NotImplementedException();
 }
コード例 #24
0
ファイル: App.xaml.cs プロジェクト: sanjayasl/Events
 private void Session_Revoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     // Cancel Cloud connection
 }
コード例 #25
0
ファイル: App.xaml.cs プロジェクト: yuezhenglingluan/CodeHub
        //private void Application_UnhandledException(
        //    object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
        //{
        //    e.Handled = true;
        //    ToastHelper.ShowMessage(e.Message, e.Exception.StackTrace);
        //}

        private void ExExecSession_Revoked(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            _ExExecSession.Dispose();
            _ExExecSession = null;
        }
コード例 #26
0
ファイル: App.xaml.cs プロジェクト: bospoort/Win10UWPDemo
 private void Session_Revoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     ShowToast("Session revoked");
 }
コード例 #27
0
 private void ExtendedSession_Revoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     Debug.WriteLine($"Revoked: {args.Reason}");
 }
コード例 #28
0
 private void ExtendedSession_Revoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     Debug.WriteLine($"Revoked: {args.Reason}");
 }
コード例 #29
0
ファイル: HomePage.xaml.cs プロジェクト: ngducnghia/TripTrak
 private void Session_Revoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     //TODO: clean up session data
     StopLocationExtensionSession();
 }
コード例 #30
0
 private void Session_Revoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     //TODO: clean up session data
     StopLocationExtensionSession();
 }
コード例 #31
0
 private static void ExtendedExecutionSession_Revoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     SendToast(LocalizableStrings.EXTENDED_EXECUTION_REVOKED);
     CancelExtension();
 }
コード例 #32
0
        private async void SessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
            {
                switch (args.Reason)
                {
                    case ExtendedExecutionRevokedReason.Resumed:
                        break;

                    case ExtendedExecutionRevokedReason.SystemPolicy:
                        Acr.UserDialogs.UserDialogs.Instance.Alert("Extended execution revoked due to system policy.",
                                        "Background Execution revoked.", "OK");
                        break;
                }

                ClearExtendedExecution();
                await BeginExtendedExecution();
            });
        }
コード例 #33
0
ファイル: IrcSocket.cs プロジェクト: MattBDev/WinIRC
        private void session_Revoked(object sender, ExtendedExecutionRevokedEventArgs args)
        {
            var toast = CreateBasicToast("Warning", "The extended execution session has been revoked. Connection may be lost when minimized.");

            ToastNotificationManager.CreateToastNotifier().Show(toast);
        }
コード例 #34
0
 private void Session_Revoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     ClearSession();
 }
コード例 #35
0
 private void ExtensionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     //Perform Operations to clode the resource.
     MainPage.NotifyUser("Not able to continue in background: Extension Revoked", 90);
 }
コード例 #36
0
		private void RevokedExtension(object sender, ExtendedExecutionRevokedEventArgs args)
		{
			LocalSettings.Values["Revoked"] = DateTime.Now.Ticks;
			LocalSettings.Values["RevokedReason"] = args.Reason.ToString();

			Debug.WriteLine("Revoked - going down!");
			Debug.WriteLine(args.Reason);
			canContinue = false;
		}
コード例 #37
0
ファイル: LocationService.cs プロジェクト: nazzi88ua/Unigram
 private void ExtendedExecutionSession_Revoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     StopTracking();
 }
コード例 #38
0
 private async void SessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
 {
     Debug.Log("Extended Execution Ended: " + args.Reason);
     EndExtendedExecution();
 }