Dela via


AppInstance.IsCurrentInstance Property

Definition

Whether the current instance of the app is the registered instance of the app for the specific key that this instance has defined.

public:
 property bool IsCurrentInstance { bool get(); };
bool IsCurrentInstance();
public bool IsCurrentInstance { get; }
var boolean = appInstance.isCurrentInstance;
Public ReadOnly Property IsCurrentInstance As Boolean

Property Value

Boolean

bool

A Boolean that indicates whether the current app is the registered instance of the app.

Examples

In the following example, if the instance found is the current instance, that instance is activated. If it is not the current instance, the example redirects to the app instance that is found.

if (theInstance.IsCurrentInstance)
{
    global::Windows.UI.Xaml.Application.Start((p) => new App(activatedArgs));
}
else
{
    theInstance.RedirectActivationTo();
}

Applies to