Share via


AppInstance.RecommendedInstance Property

Definition

A shell can recommend an instance of an app to which an application activation is redirected.

public:
 static property AppInstance ^ RecommendedInstance { AppInstance ^ get(); };
static AppInstance RecommendedInstance();
public static AppInstance RecommendedInstance { get; }
var appInstance = AppInstance.recommendedInstance;
Public Shared ReadOnly Property RecommendedInstance As AppInstance

Property Value

The app instance that the shell prefers to use for an app, or null if there is no preference.

Examples

This example checks whether the shell recommends an instance, by using the app-defined SelectedKeyIncludesMyKey method. If so, it checks whether the instance is suitable, and redirects to a suitable instance. If the shell does not have preference, the app can look for an existing app instance to redirect to or attempt to register itself as the target.

AppInstance RecommendedInstance = AppInstance.RecommendedInstance;
if ((RecommendedInstance != null) && SelectedKeyIncludesMyKey(RecommendedInstance.Key))
{
    RecommendedInstance.RedirectActivationTo();
}
else
{
    // Look for existing instance or attempt to register itself as target.
}

Remarks

If the shell provides a preference, the app can redirect activation to that instance. The app can ignore the preference.

Note

Currently, the shell does not set a non-null value for RecommendedInstance.

Applies to