Important
Some information relates to prerelease product that may be substantially modified before itâs released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Enables apps to handle state changes, manage windows, and integrate with a variety of UI frameworks.
public ref class CoreApplication abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class CoreApplication final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public static class CoreApplication
Public Class CoreApplication
Windows 10 (introduced in 10.0.10240.0)
Windows.Foundation.UniversalApiContract (introduced in v1.0)
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).
This API is supported in Universal Windows Platform apps only, except for the Properties property, which is always available.
struct App : implements<App, IFrameworkViewSource, IFrameworkView>
{
public:
IFrameworkView CreateView()
{
return *this;
}
};
...
int __stdcall wWinMain(HINSTANCE, HINSTANCE, PWSTR, int)
{
Windows::ApplicationModel::Core::CoreApplication::Run(App());
}
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;
}
internal class ApplicationSource : IFrameworkViewSource
{
public virtual IFrameworkView CreateView()
{
return new CoreApp();
}
}
...
[MTAThread]
public static int Main()
{
var appSource = new ApplicationSource();
CoreApplication.Run(appSource);
return 0;
}
Version history Windows version SDK version Value added 1607 14393 BackgroundActivated 1607 14393 EnablePrelaunch 1607 14393 EnteredBackground 1607 14393 LeavingBackground 1709 16299 RequestRestartAsync 1709 16299 RequestRestartForUserAsync Properties Id
Gets the package-relative app identifier for the process.
MainViewGets the main CoreApplicationView instance for all running apps that use this CoreApplication instance.
PropertiesGets a property set that the app and UI frameworks can use to store info while the process is running.
ViewsGets all views for the app.
Methods Events See alsoRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4