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); }
private static void ExtendedExecutionSession_Revoked(object sender, ExtendedExecutionRevokedEventArgs args) { try { if (session != null) { session.Dispose(); session = null; } } catch { } }
/// <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; } }
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 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(); }); }
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; } }); }
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(); }); }
/// <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. } }
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(); }); }
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(); }); }
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; }
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; } }); }
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; } }); }
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(); //}); }
private static void _extendedExecutionSession_Revoked(object sender, ExtendedExecutionRevokedEventArgs args) { _isStarted = false; _isRevoked = true; }
private void SessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args) { ExtendedExecutionAllowed = false; }
private void Session_Revoked(object sender, ExtendedExecutionRevokedEventArgs args) { //StopLocationExtensionSession(); StartLocationExtensionSession(); }
private void Session_Revoked(object sender, ExtendedExecutionRevokedEventArgs args) { OutputDebugString("edetocCCTSample_Tracing: ExtendedExecution revoked"); }
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; } }); }
private void Session_Revoked(object sender, ExtendedExecutionRevokedEventArgs args) { //throw new NotImplementedException(); }
private void Session_Revoked(object sender, ExtendedExecutionRevokedEventArgs args) { // Cancel Cloud connection }
//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; }
private void Session_Revoked(object sender, ExtendedExecutionRevokedEventArgs args) { ShowToast("Session revoked"); }
private void ExtendedSession_Revoked(object sender, ExtendedExecutionRevokedEventArgs args) { Debug.WriteLine($"Revoked: {args.Reason}"); }
private void Session_Revoked(object sender, ExtendedExecutionRevokedEventArgs args) { //TODO: clean up session data StopLocationExtensionSession(); }
private static void ExtendedExecutionSession_Revoked(object sender, ExtendedExecutionRevokedEventArgs args) { SendToast(LocalizableStrings.EXTENDED_EXECUTION_REVOKED); CancelExtension(); }
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(); }); }
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); }
private void Session_Revoked(object sender, ExtendedExecutionRevokedEventArgs args) { ClearSession(); }
private void ExtensionRevoked(object sender, ExtendedExecutionRevokedEventArgs args) { //Perform Operations to clode the resource. MainPage.NotifyUser("Not able to continue in background: Extension Revoked", 90); }
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; }
private void ExtendedExecutionSession_Revoked(object sender, ExtendedExecutionRevokedEventArgs args) { StopTracking(); }
private async void SessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args) { Debug.Log("Extended Execution Ended: " + args.Reason); EndExtendedExecution(); }