PackageInstallManager.InstallAsync Method

Starts installation of a package.

Syntax

public:
static IAsyncOperationWithProgress<PackageInstallResult, PackageInstallProgress>^ InstallAsync(
         String^ sourceUri
)  

Parameters

sourceUri
Type: String 

 URL to the package.

Return value

Type: IAsyncOperationWithProgress<PackageInstallResult, PackageInstallProgress

Returns an IAsyncOperationWithProgress<TResult,TProgress> object that represents the state of the asynchronous operation. Completion of the asynchronous operation is signaled by using a handler that is passed to the IAsyncOperationWithProgress<TResult,TProgress>.Completed property. Progress of the asynchronous operation is signaled by using a handler that is passed to the IAsyncOperationWithProgress<TResult,TProgress>.Progress property When the asynchronous operation is complete, the result of the operation can be retrieved by using the IAsyncOperationWithProgress<TResult,TProgress>.GetResults method.

Remarks

In Javascript the InstallAsync method is exposed as a Promise.

Example

//Install our game
function handleInstallButtonInvoked() {
    writeLog("Installing: " + installUrlForOurGame);
    XtfPackageInstallManager.installAsync(installUrlForOurGame)
        .done(
            handleInstallCompleted,
            handleInstallErrors,
            handleInstallProgress
            );
};
//Install Completed handler
function handleInstallCompleted(installResult) {
    if (installResult.errorCode) {
        writeLog("*** Error: " + installResult.packageFullName + " failed to install. Error Code: ", installResult.error);
    } else {
        writeLog("Installation of package " + installResult.packageFullName + " Completed!");
    }
};
 
//Install Errors handler
function handleInstallErrors(installError) {
    writeError("*** Failed to install your package. Error Code: ", installError);
}
 
//Install Progress handler
function handleInstallProgress(installProgress) {
    writeLog("Installing " + installProgress.packageFullName + " " + installProgress.percentComplete + "% complete.");
};  

Requirements

Namespace: Microsoft.Xbox.Tools.ConsoleExtensions

Metadata: microsoft.xbox.tools.consoleextensions.winmd

See also

Reference

PackageInstallManager Class

PackageInstallManager Members

Microsoft.Xbox.Tools.ConsoleExtensions Namespace