HostLifecycleNotifications
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices.WindowsRuntime;
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());
                };
                WindowsRuntimeMarshal.AddEventHandler<EventHandler<SuspendingEventArgs>>((Func<EventHandler<SuspendingEventArgs>, EventRegistrationToken>)CoreApplication.add_Suspending, (Action<EventRegistrationToken>)CoreApplication.remove_Suspending, _suspending);
            }
            remove {
                WindowsRuntimeMarshal.RemoveEventHandler<EventHandler<SuspendingEventArgs>>((Action<EventRegistrationToken>)CoreApplication.remove_Suspending, _suspending);
            }
        }
        public event EventHandler<HostResumingEventArgs> Resuming {
            add {
                _resuming = delegate(object o, object e) {
                    value(o, new HostResumingEventArgs());
                };
                WindowsRuntimeMarshal.AddEventHandler<EventHandler<object>>((Func<EventHandler<object>, EventRegistrationToken>)CoreApplication.add_Resuming, (Action<EventRegistrationToken>)CoreApplication.remove_Resuming, _resuming);
            }
            remove {
                WindowsRuntimeMarshal.RemoveEventHandler<EventHandler<object>>((Action<EventRegistrationToken>)CoreApplication.remove_Resuming, _resuming);
            }
        }
    }
}