示例#1
0
		public override void DidEnterBackground(UIApplication application)
		{
			var operation = new SuspendingOperation(DateTime.Now.AddSeconds(10));

			Suspending?.Invoke(this, new ApplicationModel.SuspendingEventArgs(operation));

			_suspended = true;
		}
示例#2
0
        partial void OnSuspendingPartial()
        {
            var operation = new SuspendingOperation(DateTime.Now.AddSeconds(10));

            Suspending?.Invoke(this, new ApplicationModel.SuspendingEventArgs(operation));

            _suspended = true;
        }
示例#3
0
        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();
        }
示例#4
0
        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();
        }
示例#6
0
 public SuspendStateMessage(SuspendingOperation operation)
 {
     Operation = operation;
 }
示例#7
0
 /// <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));
 }
示例#8
0
 internal SuspendingEventArgs(SuspendingOperation operation)
 {
     SuspendingOperation = operation;
 }
示例#9
0
 internal SuspendingEventArgs(SuspendingOperation operation)
 {
     SuspendingOperation = operation ?? throw new ArgumentNullException(nameof(operation));
 }