Skip to content

Latest commit

 

History

History
54 lines (42 loc) · 2.69 KB

fileupdaterequest.md

File metadata and controls

54 lines (42 loc) · 2.69 KB
-api-id -api-type -api-device-family-note
T:Windows.Storage.Provider.FileUpdateRequest
winrt class
xbox

Windows.Storage.Provider.FileUpdateRequest

-description

Provides information about a requested file update so that the app can complete the request.

-remarks

If your app participates in the Cached File Updater contract, use this class to respond when Windows fires FileUpdateRequested events to request file updates. You can access this class from your event handler using the FileUpdateRequestedEventArgs.Request property. As a part of your response to a FileUpdateRequested event, you must set the Status property of this class to indicate the status of the update.

Learn more about responding to update requests in FileUpdateRequested and FileUpdateRequestedEventArgs.

If your app can't complete the update before returning from its FileUpdateRequested event handler, you can use the GetDeferral property to finish the update asynchronously.

-examples

The File picker contracts sample demonstrates how to respond to a FileUpdateRequested event, including how to use Request to get the FileUpdateRequest.

// Event handler
void CachedFileUpdaterUI_FileUpdateRequested(CachedFileUpdaterUI sender, FileUpdateRequestedEventArgs args)
{
    fileUpdateRequest = args.Request;
    fileUpdateRequestDeferral = fileUpdateRequest.GetDeferral();
    switch (cachedFileUpdaterUI.UIStatus)
    {
        case UIStatus.Hidden:
            fileUpdateRequest.Status = FileUpdateStatus.UserInputNeeded;
            fileUpdateRequestDeferral.Complete();
            break;
        case UIStatus.Visible:
            break;
        case UIStatus.Unavailable:
            fileUpdateRequest.Status = FileUpdateStatus.Failed;
            fileUpdateRequestDeferral.Complete();
            break;
    }
}

// Register for the event
cachedFileUpdaterUI.FileUpdateRequested += CachedFileUpdaterUI_FileUpdateRequested;

args contains a FileUpdateRequestedEventArgs object.

-see-also