PackageTransferManager.RequestUpdateCurrentPackageAsync Method

Prompts the user to provide consent for an update to the current game or decline.

Syntax

public:
static IAsyncOperation<RequestUpdatePackageResult^ >^ RequestUpdateCurrentPackageAsync()  

Return value

Type: IAsyncOperation<RequestUpdatePackageResult^ > 

The result of the request.

Example

using namespace Windows::Xbox::Management::Deployment; 

// exception handling removed for brevity 
IDownloadableContentPackageManager^ packageMgr = ref new DownloadableContentPackageManager ( ); 
IDownloadableContentPackage^ package = packageMgr->FindPackages ( InstalledPackagesFilter::CurrentTitleOnly ); 
auto checkAsyncOp = transferMgr->CheckForUpdateAsync ( package ); 
auto checkTask = create_task ( checkAsyncOp ); 

try 
{ 
    checkTask.then ( [ package ] ( CheckForUpdatesResult^ result ) 
    { 
        //Force the title to update if an update is available 
        if ( result->IsUpdateAvailable) 
        { 
            // prompt the user to terminate current game, accept use of network bandwidth, and add the game to the update queue 
            auto op = PackageTransferManager::Current->RequestUpdateCurrentPackageAsync(); 
            auto updateTask = create_task ( op ); 

            updateTask.then ( [] task<void> t () 
            { 
                try 
                { 
                    t.get(); 
                    // User accepted update – CoreApplication::Suspending() event will be invoked imminently 
                } 
                catch (Platform::COMException^ e) 
                { 
                    //User cancelled update 
                    ShowGameErrorDialog(You must accept the latest update to the play multiplayer online); 
                } 
            );  
        } 
    }).wait(); 
} 

catch ( Platform::COMException^ e ) 
{ 
    // exception encountered when checking for package update... 
}  

Requirements

Namespace: Windows.Xbox.Management.Deployment

Metadata: windows.winmd

See also

Reference

PackageTransferManager Class

PackageTransferManager Members

Windows.Xbox.Management.Deployment Namespace