Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

DataProviderRequest Class

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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

public ref class DataProviderRequest sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class DataProviderRequest final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class DataProviderRequest
Public NotInheritable Class DataProviderRequest
Inheritance
Object Platform::Object IInspectable DataProviderRequest
Attributes

Windows requirements

Requirements Description
Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

async void OnDeferredImageRequestedHandler(DataProviderRequest request)
{
 // Provide updated bitmap data using delayed rendering.
 if (this.imageStream != null)
 {
 DataProviderDeferral deferral = request.GetDeferral();
 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));
 deferral.Complete();
 }
}

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.

Properties

Name Description
Deadline

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

FormatId

Specifies the format id.

Methods

Name Description
GetDeferral()

Returns a DataProviderDeferral object.

SetData(Object)

Sets the content of the DataPackage to be shared with a target app.

Applies to


Feedback

Was this page helpful?