Skip to content

Latest commit

 

History

History
54 lines (43 loc) · 2.22 KB

fileupdaterequestdeferral.md

File metadata and controls

54 lines (43 loc) · 2.22 KB
-api-id -api-type -api-device-family-note
T:Windows.Storage.Provider.FileUpdateRequestDeferral
winrt class
xbox

Windows.Storage.Provider.FileUpdateRequestDeferral

-description

Use to complete an update asynchronously.

-remarks

If your app participates in the Cached File Updater contract, and you can't finish responding to the update before returning from your FileUpdateRequested event handler, call the FileUpdaterRequestDeferral.Complete method to complete the update asynchronously.

Note

The file picker UI is disabled until the app has finished responding to all FileUpdateRequested events that were fired.

To learn about responding to a FileUpdateRequested event, see FileUpdateRequestedEventArgs.

-examples

The File picker contracts sample demonstrates how to respond to a FileUpdateRequested event, including how to get a deferral.

// 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