ApplicationExecutionState
ApplicationExecutionState
ApplicationExecutionState
ApplicationExecutionState
Enum
Definition
Specifies the execution state of the app.
public : enum class ApplicationExecutionStatepublic enum ApplicationExecutionStatePublic Enum ApplicationExecutionState// You can use this enum in JavaScript.
- Attributes
Windows 10 requirements
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Fields
| ClosedByUser ClosedByUser ClosedByUser ClosedByUser | The app was closed by the user. |
| NotRunning NotRunning NotRunning NotRunning | The app is not running. |
| Running Running Running Running | The app is running. |
| Suspended Suspended Suspended Suspended | The app is suspended. |
| Terminated Terminated Terminated Terminated | The app was terminated after being suspended. |
Remarks
This table provides more detail about when you'll see each of these states and what your app should do in response.
| State | When this state is seen | What your app should do |
|---|---|---|
| NotRunning | The user first activates the app after:
| 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 8ClosedByUser behavior, you can enable this behavior in your Windows 8.1 app when you upgrade it to Windows 8.1. To enable the Windows 8ClosedByUser 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.