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

HostLifecycleService

public static class HostLifecycleService
(Infrastructure) Provides access to the host's lifecycle management services.

Event that gets raised when the host resumes the application.

Event that gets raised when the host suspends the application.

public static void AddRef()

Adds a reference to the host lifecycle manager, causing it to be sending notifications.

public static void Release()

Removes a reference to the host lifecycle manager, causing it to stop sending notifications if the removed reference was the last one.