PackageTransferManager.RequestUpdatePackageAsync Method

Shows the size of an available downloadable content update and prompts the user to provide consent for the download or decline.

Syntax

public:
static IAsyncOperation<RequestUpdatePackageResult^ >^ RequestUpdatePackageAsync(
         IDownloadableContentPackage^ package
)  

Parameters

package
Type: IDownloadableContentPackage 

The package the request is for.

Return value

Type: IAsyncOperation<RequestUpdatePackageResult^ > 

The result of the request.

Example

using namespace Windows::Xbox::Management::Deployment; 
void CheckForPackageUpdates( Deployment::IDownloadableContentPackage^ package )
{
  auto ptm = Deployment::PackageTransferManager::Current;

  create_task( ptm->CheckForUpdateAsync( package ) )
  .then([package, ptm]( CheckForUpdateResult^ updateResult ) 
  {
    if( updateResult->IsUpdateMandatory || 
    ( updateResult->IsUpdateAvailable /* && game in a state where it can apply the update*/ ) )
    {
      bool updateMandatory = updateResult->IsUpdateMandatory; 
      // Update is ready to be applied
      // Ask the user for permission to install the update through TCUI
      create_task( ptm->RequestUpdatePackageAsync( package ) )
      .then([this, package, updateMandatory]( RequestUpdatePackageResult^ requestResult )
      {
        if(SUCCEEDED(requestResult->Result.Value))
        {
          // User has accepted update, and system can start the download.
          // Do cleanup if the package was mounted. The package MUST be unmounted
          // before this task returns .
          if(package->IsMounted) UnmountDLCPackage(package);
        }
        else if( updateMandatory /* && userPlayingOnline */ )
        {
          if(package->IsMounted) UnmountDLCPackage(package);
        }
      });
    }
  });
}  

Requirements

Namespace: Windows.Xbox.Management.Deployment

Metadata: windows.winmd

See also

Reference

PackageTransferManager Class

PackageTransferManager Members

Windows.Xbox.Management.Deployment Namespace