public override void DidEnterBackground(UIApplication application) { var operation = new SuspendingOperation(DateTime.Now.AddSeconds(10)); Suspending?.Invoke(this, new ApplicationModel.SuspendingEventArgs(operation)); _suspended = true; }
partial void OnSuspendingPartial() { var operation = new SuspendingOperation(DateTime.Now.AddSeconds(10)); Suspending?.Invoke(this, new ApplicationModel.SuspendingEventArgs(operation)); _suspended = true; }
partial void OnSuspendingPartial() { var operation = new SuspendingOperation(DateTime.Now.AddSeconds(30), () => { Suspended = true; NSApplication.SharedApplication.KeyWindow.PerformClose(null); }); Suspending?.Invoke(this, new SuspendingEventArgs(operation)); operation.EventRaiseCompleted(); }
partial void OnSuspendingPartial() { var completed = false; var operation = new SuspendingOperation(DateTime.Now.AddSeconds(0), () => completed = true); Suspending?.Invoke(this, new SuspendingEventArgs(operation)); if (!completed && this.Log().IsEnabled(LogLevel.Warning)) { this.Log().LogWarning($"This platform does not support asynchronous Suspending deferral. Code executed after the of the method called by Suspending may not get executed."); } }
async public void App_Suspending(object sender, object e) { SuspendingOperation op = (e as SuspendingEventArgs).SuspendingOperation; SuspendingDeferral deferral = op.GetDeferral(); //Begin 5 seconds await SaveFile(false, false); //End 5 seconds deferral.Complete(); }
public SuspendStateMessage(SuspendingOperation operation) { Operation = operation; }
/// <summary> /// Hook method that is called when the page is suspended. /// Remember that <see cref="OnNavigatedFromAsync(IDictionary{string, object}, bool)"/> is not called in this case. /// </summary> /// <param name="op">The suspension args.</param> public virtual Task OnSuspendingAsync(SuspendingOperation op) { return(Task.FromResult <object>(null)); }
internal SuspendingEventArgs(SuspendingOperation operation) { SuspendingOperation = operation; }
internal SuspendingEventArgs(SuspendingOperation operation) { SuspendingOperation = operation ?? throw new ArgumentNullException(nameof(operation)); }