Share via


CachedFileUpdaterUI Class

Definition

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

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
Inheritance
Object Platform::Object IInspectable CachedFileUpdaterUI
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 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();
        }

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

Retrieve a CachedFileUpdaterUI object using the CachedFileUpdaterActivatedEventArgs.CachedFileUpdaterUI property.

Properties

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

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

UpdateRequest

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

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

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

Events

FileUpdateRequested

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

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.

Applies to

See also