DataProviderRequest クラス

定義

この型のオブジェクトは、 DataProviderHandler デリゲートに渡されます。

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
継承
Object Platform::Object IInspectable DataProviderRequest
属性

Windows の要件

デバイス ファミリ
Windows 10 (10.0.10240.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v1.0 で導入)

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

注釈

このオブジェクトは、共有を数ミリ秒間遅延 (遅延) する必要がある場合に使用します。 詳細については、「共有を遅延させる方法」をチェック。

プロパティ

Deadline

遅延レンダリング操作を完了するための期限を取得します。 実行が期限を超えた場合、遅延レンダリングの結果は無視されます。

FormatId

形式 ID を指定します。

メソッド

GetDeferral()

DataProviderDeferral オブジェクトを返します。

SetData(Object)

ターゲット アプリと共有する DataPackage のコンテンツを設定します。

適用対象