Partager via


DataProviderRequest.GetDeferral Méthode

Définition

Renvoie un objet DataProviderDeferral .

public:
 virtual DataProviderDeferral ^ GetDeferral() = GetDeferral;
DataProviderDeferral GetDeferral();
public DataProviderDeferral GetDeferral();
function getDeferral()
Public Function GetDeferral () As DataProviderDeferral

Retours

Objet de report du fournisseur de données.

Exemples

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

Remarques

Pour plus d’informations, case activée comment produire les données demandées de manière asynchrone.

S’applique à