This topic has not yet been rated - Rate this topic

DataRequestDeferral class

Applies to Windows and Windows Phone

Enables you to exchange content with a target app asynchronously.

Syntax


var dataRequestDeferral = getDeferral();

Attributes

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

Members

The DataRequestDeferral class has these types of members:

Methods

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

MethodDescription
Complete Indicates that the content for an asynchronous share is ready for a target app, or that an error in the sharing operation occurred.

 

Remarks

You get an instance of the DataRequestDeferral class when you call the getDeferral method of a DataPackage.

Examples

This example shows how to get a DataRequestDeferral object as part of sharing an image with a target app.


function registerForShare() {
    var dataTransferManager = Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView();
    dataTransferManager.addEventListener("datarequested", shareImageHandler);
}

function shareImageHandler(e) {
    var request = e.request;
    request.data.properties.title = "Share Image Example";
    request.data.properties.description = "A demonstration that shows how to share an image.";
    var deferral = request.getDeferral();
    Windows.ApplicationModel.Package.current.installedLocation.getFileAsync("images\\smalllogo.png").then(function (thumbnailFile) {
        request.data.properties.thumbnail = Windows.Storage.Streams.RandomAccessStreamReference.createFromFile(thumbnailFile);
        return Windows.ApplicationModel.Package.current.installedLocation.getFileAsync("images\\logo.png");
    }).done(function (imageFile) {
        request.data.setBitmap(Windows.Storage.Streams.RandomAccessStreamReference.createFromFile(imageFile));
        deferral.complete();
    }, function (err) {
        request.failWithDisplayText(err);
    });
}


Requirements

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 Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.ApplicationModel.DataTransfer
Windows::ApplicationModel::DataTransfer [C++]

Metadata

Windows.winmd

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.