Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ApplicationExecutionState enumeration

Applies to Windows and Windows Phone

Specifies the execution state of the app.

Syntax


public enum ApplicationExecutionState

Attributes

[Version(0x06020000)]

Members

The ApplicationExecutionState enumeration has these members.

MemberValueDescription
NotRunning | notRunning0

The app is not running.

Running | running1

The app is running.

Suspended | suspended2

The app is suspended.

Terminated | terminated3

The app was terminated after being suspended.

ClosedByUser | closedByUser4

The app was closed by the user.

Remarks

This table provides more detail about when you'll see each of these states and what your app should do in response.

StateWhen this state is seenWhat your app should do
NotRunning

The user first activates the app after:

  • installing the app from the Store
  • clicking End task in Task Manager while the app is running
  • rebooting the computer
  • logging off and back on

The user closes the app through the close gesture or Alt+F4 and activates it within about 10 seconds of closing it.

Display its initial UI and perform initialization tasks.
Running

The app is activated through a secondary tile or one of the activation contracts and extensions while it is running.

Respond to the activation event as appropriate.
Suspended

The app is activated through a secondary tile or one of the activation contracts and extensions while Windows is suspending it or after Windows has suspended it.

Respond to the activation event as appropriate.
Terminated

Windows successfully suspends the app and then it is terminated. For example, Windows can terminate a suspended app if the system is running low on resources. Some apps, such as games, can be pretty resource intensive.

Restore itself to the way the user left it, rather than starting fresh. Use data saved during app suspension. Refresh content or network connections that may have become stale.
ClosedByUser

The user closes the app through the close gesture or Alt+F4 and takes longer than 10 seconds to activate the app again.

In Windows 8, display its initial UI and perform initialization tasks, rather than restoring its previous state.

In Windows 8.1, restore itself to the way the user left it, rather than starting fresh. Use data saved during app suspension. Refresh content or network connections that may have become stale.

Note  If your Windows 8 app depends on the Windows 8 ClosedByUser behavior, you can enable this behavior in your Windows 8.1 app when you upgrade it to Windows 8.1. To enable the Windows 8 ClosedByUser behavior, set your Windows 8.1 app to terminate when the last window is closed with the Windows.UI.ViewManagement.ApplicationView.TerminateAppOnFinalViewClose property.

 

Windows Phone 8

On Windows Phone, only NotRunning and Suspended are supported.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows.ApplicationModel.Activation
Windows::ApplicationModel::Activation [C++]

Metadata

Windows.winmd

See also

Concepts
Application lifecycle
Guidelines for app suspend and resume
Reference (C#/VB/C++)
CachedFileUpdaterActivatedEventArgs.PreviousExecutionState
CameraSettingsActivatedEventArgs.PreviousExecutionState
ContactPickerActivatedEventArgs.PreviousExecutionState
DeviceActivatedEventArgs.PreviousExecutionState
FileActivatedEventArgs.PreviousExecutionState
FileOpenPickerActivatedEventArgs.PreviousExecutionState
FileSavePickerActivatedEventArgs.PreviousExecutionState
LaunchActivatedEventArgs.PreviousExecutionState
PrintTaskSettingsActivatedEventArgs.PreviousExecutionState
ProtocolActivatedEventArgs.PreviousExecutionState
SearchActivatedEventArgs.PreviousExecutionState
ShareTargetActivatedEventArgs.PreviousExecutionState
Reference (JavaScript)
WebUICachedFileUpdaterActivatedEventArgs.previousExecutionState
WebUICameraSettingsActivatedEventArgs.previousExecutionState
WebUIContactPickerActivatedEventArgs.previousExecutionState
WebUIDeviceActivatedEventArgs.previousExecutionState
WebUIFileActivatedEventArgs.previousExecutionState
WebUIFileOpenPickerActivatedEventArgs.previousExecutionState
WebUIFileSavePickerActivatedEventArgs.previousExecutionState
WebUILaunchActivatedEventArgs.previousExecutionState
WebUIPrintTaskSettingsActivatedEventArgs.previousExecutionState
WebUIProtocolActivatedEventArgs.previousExecutionState
WebUISearchActivatedEventArgs.previousExecutionState
WebUIShareTargetActivatedEventArgs.previousExecutionState

 

 

Show:
© 2014 Microsoft