Share via


CachedFileUpdaterUI 類別

定義

如果您的應用程式透過快取檔案更新程式合約提供檔案更新,則用來與檔案選擇器互動。

public ref class CachedFileUpdaterUI sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class CachedFileUpdaterUI final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class CachedFileUpdaterUI
Public NotInheritable Class CachedFileUpdaterUI
繼承
Object Platform::Object IInspectable CachedFileUpdaterUI
屬性

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 引進)

範例

檔案選擇器合約範例示範如何回應CachedFileUpdater啟動的事件。

// CachedFileUpdater activated event handler
protected override void OnCachedFileUpdaterActivated(CachedFileUpdaterActivatedEventArgs args)
{
    var CachedFileUpdaterPage = new SDKTemplate.CachedFileUpdaterPage();
    CachedFileUpdaterPage.Activate(args);
}

// Overloaded method to respond to CachedFileUpdater events
public void Activate(CachedFileUpdaterActivatedEventArgs args)
{
            // Get file picker UI
            cachedFileUpdaterUI = args.CachedFileUpdaterUI;

            cachedFileUpdaterUI.FileUpdateRequested += CachedFileUpdaterUI_FileUpdateRequested;
            cachedFileUpdaterUI.UIRequested += CachedFileUpdaterUI_UIRequested;

            switch (cachedFileUpdaterUI.UpdateTarget)
            {
                case CachedFileTarget.Local:
                    scenarios = new List<Scenario> { new Scenario() { Title = "Get latest version", ClassType = typeof(FilePickerContracts.CachedFileUpdater_Local) } };
                    break;
                case CachedFileTarget.Remote:
                    scenarios = new List<Scenario> { new Scenario() { Title = "Remote file update", ClassType = typeof(FilePickerContracts.CachedFileUpdater_Remote) } };
                    break;
            }

            Window.Current.Activate();
        }

針對 C#, args 包含 CachedFileUpdaterActivatedEventArgs 物件。 此外, OnCachedFileUpdaterActivated 位於 App.xaml.cs 檔案中, Activate 而 方法位於 檔案選擇器合約範例的 CachedFileUpdaterPage.xaml.cs 檔案中。

備註

使用 CachedFileUpdaterActivatedEventArgs.CachedFileUpdaterUI 屬性擷取 CachedFileUpdaterUI 物件。

屬性

Title

取得或設定要在檔案選擇器 UI 左上方顯示的標題。 標題會識別應用程式頁面的位置或內容, (裝載于使用者的檔案選擇器 UI 中) 。

UIStatus

取得列舉值,指出檔案選擇器 UI 的狀態。

UpdateRequest

取得快取檔案更新程式目前正在處理的檔案更新要求。

UpdateTarget

取得值,指出需要更新的檔案版本:應用程式存放庫中的本機版本或版本。

方法

GetDeferral()

取得物件,這個物件用來以非同步方式完成檔案更新要求。

事件

FileUpdateRequested

當 Windows 要求檔案更新時引發。 此事件會針對每個要求的更新引發一次。

UIRequested

當呼叫的應用程式需要顯示 CachedFileUpdaterUI 物件所代表的檔案選擇器信件箱 UI 時引發。

伺服器可能會延遲其 UI 初始化,直到收到此事件為止。

適用於

另請參閱