Windows Dev Center

CachedFileUpdater class

Manages files so that they can be updated in real-time by an app that participates in the Cached File Updater contract.

Syntax


public static class CachedFileUpdater

Attributes

[MarshalingBehavior(Agile)]
[Version(0x06020000)]

Members

The CachedFileUpdater class has these types of members:

Methods

The CachedFileUpdater class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
SetUpdateInformation Configures update policies for a local file.

 

Remarks

Access methods in this class statically.

Examples

The File picker contracts sample demonstrates how to set update information for a file in its TargetFileRequested event handler.



private async void OnTargetFileRequested(FileSavePickerUI sender, TargetFileRequestedEventArgs e)
{
    // Handle the TargetFileRequested event on the background thread on which it was raised

    // Requesting a deferral allows the app to call another asynchronous method and complete the request at a later time
    var deferral = e.Request.GetDeferral();

    StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync(sender.FileName, CreationCollisionOption.ReplaceExisting);

    // Set update info for the file
    CachedFileUpdater.SetUpdateInformation(file, "CachedFile", ReadActivationMode.NotNeeded, WriteActivationMode.AfterWrite, CachedFileOptions.RequireUpdateOnAccess);

    // Assign the resulting file to the targetFile property and complete the deferral to indicate success  
    e.Request.TargetFile = file;
    deferral.Complete();
}

Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Storage.Provider
Windows::Storage::Provider [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.Storage.Provider
Windows::Storage::Provider [C++]

Metadata

Windows.winmd

See also

Object

 

 

Show:
© 2015 Microsoft