Megosztás a következőn keresztül:


FileUpdateRequest Class

Definition

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

public ref class FileUpdateRequest sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class FileUpdateRequest final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class FileUpdateRequest
Public NotInheritable Class FileUpdateRequest
Inheritance
Object Platform::Object IInspectable FileUpdateRequest
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

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.

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.

Properties

ContentId

Gets the unique identifier used to associate the local version of a file with the corresponding remote version.

File

Gets a StorageFile object that represents the locally cached copy of the file to update.

Status

Gets or sets the status of the update. This property is set in response to a FileUpdateRequested event.

UserInputNeededMessage

Gets or sets a message to the user indicating that user input is needed to complete the FileUpdateRequest.

Methods

GetDeferral()

Gets an object used to complete an update asynchronously.

UpdateLocalFile(IStorageFile)

Provide a new version of the local file to represent the remote file.

Applies to