LauncherOptions.Context Property

Context for the launched app.

Syntax

public:
property Object^ Context {
         Object^ get ();
         void set (Object^ value);
}  

Property value

Type: Object 

 Returns the context for the launched app.

Requirements

Namespace: Windows.System

Metadata: windows.winmd

Remarks

Context is used to set the current user for the app to be launched. Once the new app is launched the current user can be retrieved from CoreApplicationContext.CurrentUser.

It is best practice to explicitly set the current user by setting the Context property and passing it to Launcher::LaunchUriAsync(Uri,LauncherOptions).

If the current user is not explicitly set before calling Launcher::LaunchUriAsync(Uri,LauncherOptions) (or LaunchUriAsync(Uri) is called), the current user will be set to whoever had focus in Home last. Failing to explicitly set the current user can result in user information being displayed for a user other than the user who triggered the call to Launcher::LaunchUriAsync(Uri,LauncherOptions). For example, when showing a user’s friends or profile, the wrong user’s information would be displayed.

Example

var launcherOptions = new Windows.System.LauncherOptions();
launcherOptions.context = currentUser; //currentUser is an IUser that the app has from activation or account picker
 
Windows.System.Launcher.launchUriAsync(activationUri, launcherOptions);  

See also

Reference

LauncherOptions Class

LauncherOptions Members

Windows.System Namespace