Share via


CachedFileUpdater クラス

定義

キャッシュされたファイル アップデーター コントラクトに参加するアプリによってファイルをリアルタイムで更新できるように、ファイルを管理します。

public ref class CachedFileUpdater abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class CachedFileUpdater final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public static class CachedFileUpdater
Public Class CachedFileUpdater
継承
Object Platform::Object IInspectable CachedFileUpdater
属性

Windows の要件

デバイス ファミリ
Windows 10 (10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox で導入)
API contract
Windows.Foundation.UniversalApiContract (v1.0 で導入)

ファイル ピッカー コントラクトのサンプルでは、TargetFileRequested イベント ハンドラーでファイルの更新情報を設定する方法を示します。

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();
}

注釈

このクラスのメソッドに静的にアクセスします。

メソッド

SetUpdateInformation(IStorageFile, String, ReadActivationMode, WriteActivationMode, CachedFileOptions)

ローカル ファイルの更新ポリシーを構成します。

適用対象

こちらもご覧ください