Example #1
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();
        }
Example #2
0
        partial void OnSuspendingPartial()
        {
            var completed = false;
            var operation = new SuspendingOperation(DateTime.Now.AddSeconds(0), () => completed = true);

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

            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.");
            }
        }