DataRequestDeferral 类

定义

使你能够以异步方式与目标应用交换内容。

public ref class DataRequestDeferral sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class DataRequestDeferral final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class DataRequestDeferral
Public NotInheritable Class DataRequestDeferral
继承
Object Platform::Object IInspectable DataRequestDeferral
属性

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

示例

此示例演示如何获取 DataRequestDeferral 对象作为与目标应用共享图像的一部分。

void DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
{
    DataRequestDeferral deferral = e.Request.GetDeferral();
    e.Request.Data.Properties.Title = "Hello World!";
    e.Request.Data.Properties.Description = "This example shows how to share files and images.";
    if (this.dataPackageThumbnail != null)
    {
        e.Request.Data.Properties.Thumbnail = this.dataPackageThumbnail;
    }
    e.Request.Data.SetBitmap(imageStreamRef);
    deferral.Complete();
}

注解

调用 DataPackage 的 getDeferral 方法时,将获得 DataRequestDeferral 类的实例。

方法

Complete()

指示异步共享的内容已准备好用于目标应用,或者共享操作中发生了错误。

适用于