Microsoft Silverlight will reach end of support after October 2021. Learn more.
Defines methods that application extension services can optionally implement in order to respond to application lifetime events.
Assembly: System.Windows (in System.Windows.dll)
'Declaration Public Interface IApplicationLifetimeAware
public interface IApplicationLifetimeAware
The IApplicationLifetimeAware type exposes the following members.
|Exited||Called by an application immediately after the Application.Exit event occurs.|
|Exiting||Called by an application immediately before the Application.Exit event occurs.|
|Started||Called by an application immediately after the Application.Startup event occurs.|
|Starting||Called by an application immediately before the Application.Startup event occurs.|
You can add extension services to an application using XAML or procedural code with the Application.ApplicationLifetimeObjects property.
Application extension services must implement the IApplicationService interface in order to perform start and stop operations. Additionally, application extension services can implement the optional IApplicationLifetimeAware interface in order to perform operations immediately before and after the Application.Startup and Application.Exit events.
The following list indicates the order in which application lifetime events occur and the IApplicationService and IApplicationLifetimeAware methods are called:
The application calls the IApplicationService.StartService method for each application service.
The application calls the Starting method for each IApplicationLifetimeAware service.
The Application.Startup event occurs.
The application calls the Started method for each IApplicationLifetimeAware service.
The application runs until the stop sequence is initiated by user action. This typically occurs when the user closes the application or browser window, or navigates to a new Web page.
The application calls the Exiting method for each IApplicationLifetimeAware service.
The Application.Exit event occurs.
The application calls the Exited method for each IApplicationLifetimeAware service.
The application calls the IApplicationService.StopService method for each application service.
The application calls each service method one time per service. These methods are called in the order that the services were registered, except that the StopService methods are called in the opposite order. This enables orderly cleanup.
For more information, see Application Extension Services.
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.