語言

AppInstance 類別

定義

代表應用程式的實例。

public ref class AppInstance sealed
/// [Windows.Foundation.Metadata.Experimental]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Version(1)]
class AppInstance final
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Windows.AppLifecycle.AppLifecycleContract, 65536)]
class AppInstance final
[Windows.Foundation.Metadata.Experimental]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Version(1)]
public sealed class AppInstance
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Windows.AppLifecycle.AppLifecycleContract), 65536)]
public sealed class AppInstance
Public NotInheritable Class AppInstance
繼承
Object Platform::Object IInspectable AppInstance
屬性

範例

關於如何使用此類別的程式碼範例,請參見 應用程式實例化。

備註

欲了解更多使用此類別的資訊,請參閱 應用程式實例化。

屬性

名稱 Description
IsCurrent

會取得一個值,表示這個 AppInstance 物件代表的是目前的應用程式實例還是其他實例。

Key

會取得應用程式定義的字串值,用來識別目前應用程式實例,方便重定向。

ProcessId

取得應用程式實例的程序 ID。

方法

名稱 Description
FindOrRegisterForKey(String)

向平台註冊應用程式實例,或在已有實例註冊此金鑰時尋找現有實例。

GetActivatedEventArgs()

透過 ActivationRegistrationManager 類別的靜態方法之一,取得應用程式啟用的事件參數。

GetCurrent()

擷取目前執行中的應用程式實例。

GetInstances()

擷取所有執行中的應用程式實例集合。

RedirectActivationToAsync(AppActivationArguments)

將目前的啟用請求導向到另一個應用程式實例。

Restart(String)

重新啟動應用程式實例。

UnregisterKey()

取消註冊該應用程式實例的指定金鑰。

事件

名稱 Description
Activated

針對透過 Microsoft.Windows 重新導向的啟用事件而被提出。AppLifecycle.AppInstance.RedirectActivationToAsync.

適用於

另請參閱