<PackageReference Include="System.Reactive" Version="6.0.0" />

HostLifecycleNotifications

using System.Runtime.CompilerServices; using Windows.ApplicationModel; using Windows.ApplicationModel.Core; namespace System.Reactive.PlatformServices { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] internal sealed class HostLifecycleNotifications : IHostLifecycleNotifications { [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] private EventHandler<SuspendingEventArgs> _suspending; [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] private EventHandler<object> _resuming; public event EventHandler<HostSuspendingEventArgs> Suspending { add { _suspending = delegate(object o, SuspendingEventArgs e) { value(o, new HostSuspendingEventArgs()); }; CoreApplication.Suspending += _suspending; } remove { CoreApplication.Suspending -= _suspending; } } public event EventHandler<HostResumingEventArgs> Resuming { add { _resuming = delegate(object o, object e) { value(o, new HostResumingEventArgs()); }; CoreApplication.Resuming += _resuming; } remove { CoreApplication.Resuming -= _resuming; } } } }