Activatable Lifetime v11.1
The IActivatableLifetime
service defines a set of methods and events related to the activation and deactivation lifecycle of an application. IActivatableLifetime
is a global app-level service that can be accessed from the Application instance using the TryGetService
method: Application.Current.TryGetService<IActivatableLifetime>()
.
Events
Activated
An event that is raised when the application is Activated for various reasons as described by the ActivationKind enumeration.
Deactivated
An event that is raised when the application is Deactivated for various reasons as described by the ActivationKind enumeration.
Methods
TryLeaveBackground
Tells the application that it should attempt to leave its background state. Returns true if it was possible and the platform supports this. False otherwise.
For example on macOS this would be [NSApp unhide].
TryEnterBackground
Tells the application that it should attempt to enter its background state.
Returns true if it was possible and the platform supports this. False otherwise.
For example on macOS this would be [NSApp hide].