Enables apps to handle state changes, manage windows, and integrate with a variety of UI frameworks.
Syntax
Attributes
- MarshalingBehaviorAttribute(Agile)
- MuseAttribute()
- StaticAttribute(Windows.ApplicationModel.Core.ICoreApplicationExit, NTDDI_WIN8)
- StaticAttribute(Windows.ApplicationModel.Core.ICoreApplicationUseCount, NTDDI_WIN8)
- StaticAttribute(Windows.ApplicationModel.Core.ICoreImmersiveApplication, NTDDI_WIN8)
- StaticAttribute(Windows.ApplicationModel.Core.ICoreApplication, NTDDI_WIN8)
- VersionAttribute(NTDDI_WIN8)
- WebHostHiddenAttribute()
Members
The CoreApplication class has these types of members:
Events
The CoreApplication class has these events.
| Event | Description |
|---|---|
| Exiting | Occurs when the app is shutting down. |
| Resuming | Occurs when an app is resuming. |
| Suspending | Occurs when the app is suspending. |
Methods
The CoreApplication class has these methods. It also inherits methods from the Object class.
| Method | Description |
|---|---|
| CreateNewView | Creates a new view for the app. |
| DecrementApplicationUseCount | Decrements the total count of running app instances that use this CoreApplication instance. |
| Exit | Shuts down the app. Do not use this method to shut down an app outside of testing or debugging scenarios. |
| GetCurrentView | Gets the active view for the app. |
| IncrementApplicationUseCount | Increments the total count of running app instances that use this CoreApplication instance. |
| Run | Runs an external view provider factory to obtain a view provider. |
| RunWithActivationFactories | Runs an activatable type factory to obtain an external activatable type. |
Properties
The CoreApplication class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read-only | Gets the package-relative app identifier (PRAID) for the process. | |
| Read-only | Gets the main CoreApplicationView instance for all running apps that use this CoreApplication instance. | |
| Read-only | Gets a property set that the app and UI frameworks can use to store info while the process is running. | |
| Read-only | Gets all views for the app. |
Remarks
The system creates this object as a singleton when it runs the app. It is run as an Application Single-Threaded Apartment (ASTA). Threads created from the app singleton, such as the view provider (seen in the sample below), should be attributed as Multi-Threaded Apartment (MTAThread).
ref class MyFrameworkViewSource : IFrameworkViewSource { public: virtual IFrameworkView^ CreateView() { return ref new MyFrameworkView(); } }; // ... [Platform::MTAThread] int main(Platform::Array<Platform::String^>^) { auto frameworkViewSource = ref new MyFrameworkViewSource(); Windows::ApplicationModel::Core::CoreApplication::Run(frameworkViewSource); return 0; }
Windows Phone 8
This API is supported in native apps only, except for the Properties property, which is always available.
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Minimum supported phone | Windows Phone 8 |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 2/25/2013