CachedFileUpdaterUI CachedFileUpdaterUI CachedFileUpdaterUI CachedFileUpdaterUI CachedFileUpdaterUI Class

Definition

Used to interact with the file picker if your app provides file updates through the Cached File Updater contract.

public : sealed class CachedFileUpdaterUI : ICachedFileUpdaterUI, ICachedFileUpdaterUI2
struct winrt::Windows::Storage::Provider::CachedFileUpdaterUI : ICachedFileUpdaterUI, ICachedFileUpdaterUI2
public sealed class CachedFileUpdaterUI : ICachedFileUpdaterUI, ICachedFileUpdaterUI2
Public NotInheritable Class CachedFileUpdaterUI Implements ICachedFileUpdaterUI, ICachedFileUpdaterUI2
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Examples

The File picker contracts sample demonstrates how to respond to a cachedFileUpdater activated event.


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

// cachedFileUpdater activated event handler
function activated(eventObject) {
        // Identify whether app was launched for cachedFileUpdater
        if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.cachedFileUpdater) {
            // Perform tasks to prepare your app to display its file picker page

            // Get file picker UI
            cachedFileUpdaterUI = eventObject.detail.cachedFileUpdaterUI;

            cachedFileUpdaterUI.addEventListener("fileupdaterequested", onFileUpdateRequest);
            cachedFileUpdaterUI.addEventListener("uirequested", onUIRequested);

            switch (cachedFileUpdaterUI.updateTarget) {
                case Windows.Storage.Provider.CachedFileTarget.local:
                    scenarios = [{ url: "/html/cachedFileUpdaterScenario1.html", title: "Get latest version" }];
                    break;
                case Windows.Storage.Provider.CachedFileTarget.remote:
                    scenarios = [{ url: "/html/cachedFileUpdaterScenario2.html", title: "Remote file update" }];
                    break;
            }
            SdkSample.scenarios = scenarios;
        }
    }

// Register the activated event handler
WinJS.Application.addEventListener("activated", activated, false);

For JavaScript, eventObject contains a webUICachedFileUpdaterActivatedEventArgs object.

For C#, args contains a CachedFileUpdaterActivatedEventArgs object. Additionally, the OnCachedFileUpdaterActivated is in the App.xaml.cs file and the Activate method is in the CachedFileUpdaterPage.xaml.cs file of the File picker contracts sample.

Remarks

In JavaScript, retrieve a CachedFileUpdaterUI object using the webuiCachedFileUpdaterActivatedEventArgs.cachedFileUpdaterUI property.

In C#, C++, and VB, retrieve a CachedFileUpdaterUI object using the CachedFileUpdaterActivatedEventArgs.CachedFileUpdaterUI property.

Properties

Title Title Title Title Title

Gets or sets the title to display in the top-left the file picker UI. The title identifies the location or context of the app's page (which is hosted in the file picker UI) for the user.

UIStatus UIStatus UIStatus UIStatus UIStatus

Gets an enum value that indicates the status of the file picker UI.

UpdateRequest UpdateRequest UpdateRequest UpdateRequest UpdateRequest

Gets the file update request currently being processed by the cached file updater.

UpdateTarget UpdateTarget UpdateTarget UpdateTarget UpdateTarget

Gets a value that indicates which version of the file needs to be updated: the local version or the version in the app's repository.

Methods

GetDeferral() GetDeferral() GetDeferral() GetDeferral() GetDeferral()

Gets an object used to complete a file update request asynchronously.

Events

FileUpdateRequested FileUpdateRequested FileUpdateRequested FileUpdateRequested FileUpdateRequested

Fires when the Windows requests a file update. This event fires once for each requested update.

UIRequested UIRequested UIRequested UIRequested UIRequested

Fires when the calling app needs to display the file picker letterbox UI that is represented by the CachedFileUpdaterUI object.

A server may defer its UI initialization until it receives this event.

See Also