Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

IApplicationLifetimeAware Interface

Silverlight

Defines methods that application extension services can optionally implement in order to respond to application lifetime events.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)
public interface IApplicationLifetimeAware

The IApplicationLifetimeAware type exposes the following members.

  NameDescription
Public methodSupported by Silverlight for Windows PhoneExitedCalled by an application immediately after the Application.Exit event occurs.
Public methodSupported by Silverlight for Windows PhoneExitingCalled by an application immediately before the Application.Exit event occurs.
Public methodSupported by Silverlight for Windows PhoneStartedCalled by an application immediately after the Application.Startup event occurs.
Public methodSupported by Silverlight for Windows PhoneStartingCalled by an application immediately before the Application.Startup event occurs.
Top

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:

  1. The application calls the IApplicationService.StartService method for each application service.

  2. The application calls the Starting method for each IApplicationLifetimeAware service.

  3. The Application.Startup event occurs.

  4. The application calls the Started method for each IApplicationLifetimeAware service.

  5. 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.

  6. The application calls the Exiting method for each IApplicationLifetimeAware service.

  7. The Application.Exit event occurs.

  8. The application calls the Exited method for each IApplicationLifetimeAware service.

  9. 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.

Silverlight

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.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.