导出 (0) 打印
全部展开
信息
您所需的主题如下所示。但此主题未包含在此库中。

CoreApplication Class

让应用程序能够处理状态更改、管理窗口,并与各种 UI 框架集成。

语法


public static class CoreApplication

特性

[MarshalingBehavior(Agile)]
[Muse()]
[Version(0x06020000)]
[WebHostHidden()]

成员

CoreApplication类 具有这些类型的成员:

事件

CoreApplication类 具有这些事件。

事件说明
Exiting Occurs when the app is shutting down.
Resuming Occurs when an app is resuming.
Suspending Occurs when the app is suspending.
UnhandledErrorDetected Occurs when there is an underlying error that is routed to the CoreApplication instance, as part of global error handling logic.

 

方法

The CoreApplication 类 具有这些方法。 它还继承方法于Object 类.

方法说明
CreateNewView() Creates a new view for the app.
CreateNewView(String, String) 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.

 

属性

CoreApplication类 具有这些属性。

属性访问类型说明

Id

只读Gets the package-relative app identifier (PRAID) for the process.

MainView

只读Gets the main CoreApplicationView instance for all running apps that use this CoreApplication instance.

Properties

只读Gets a property set that the app and UI frameworks can use to store info while the process is running.

Views

只读Gets all views for the app.

 

备注

在运行应用程序时,系统创建此对象作为一个单一实例。它作为应用程序单线程单元 (ASTA) 运行。将从应用程序单一实例(如视图提供程序(请参见以下示例))创建的线程的属性设置为多线程单元 (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

此 API 仅支持本机应用程序,但 Properties 属性除外,该属性始终可用。

要求

最低支持客户端

Windows 8 [仅 Windows 应用商店应用程序]

最低支持服务器

Windows Server 2012 [仅 Windows 应用商店应用程序]

最低支持电话

Windows Phone 8 [仅限本机应用]

命名空间

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

元数据

Windows.winmd

另请参见

DirectX 交换链实现示例
CoreApplicationView

 

 

显示:
© 2014 Microsoft