Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataProviderRequest class

Applies to Windows and Windows Phone

An object of this type is passed to the DataProviderHandler delegate.

Syntax


public sealed class DataProviderRequest

Attributes

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

Members

The DataProviderRequest class has these types of members:

Methods

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

MethodDescription
GetDeferral Returns a DataProviderDeferral object.
SetData Sets the content of the DataPackage to be shared with a target app.

 

Properties

The DataProviderRequest class has these properties.

PropertyAccess typeDescription

Deadline

Read-onlyGets the deadline for finishing a delayed rendering operation. If execution goes beyond that deadline, the results of delayed rendering are ignored.

FormatId

Read-onlySpecifies the format id.

 

Remarks

Use this object when you need to delay, or defer, a share for a few milliseconds. To learn more, check out How to delay sharing.

Examples


async void OnDeferredImageRequestedHandler(DataProviderRequest request)
{
    // Here we provide updated Bitmap data using delayed rendering
    if (this.imageStream != null)
    {
        DataProviderDeferral deferral = request.GetDeferral();

        try
        {
            InMemoryRandomAccessStream inMemoryStream = new InMemoryRandomAccessStream();

            // Decode the image
            BitmapDecoder imageDecoder = await BitmapDecoder.CreateAsync(this.imageStream);

            // Re-encode the image at 50% width and height
            BitmapEncoder imageEncoder = await BitmapEncoder.CreateForTranscodingAsync(inMemoryStream, imageDecoder);
            imageEncoder.BitmapTransform.ScaledWidth = (uint)(imageDecoder.OrientedPixelHeight * 0.5);
            imageEncoder.BitmapTransform.ScaledHeight = (uint)(imageDecoder.OrientedPixelHeight * 0.5);
            await imageEncoder.FlushAsync();

            request.SetData(RandomAccessStreamReference.CreateFromStream(inMemoryStream));
        }

        catch (Exception ex)
        {
            // Handle the exception
        }

        finally
        {
            deferral.Complete();
        }
    }
}


Requirements

Minimum supported client

Windows 8 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 [Windows Store apps, desktop apps]

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

 

 

Show:
© 2014 Microsoft