共用方式為


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

備註

當您呼叫DataPackagegetDeferral方法時,您會取得 DataRequestDeferral 類別的實例。

方法

Complete()

指出非同步共用的內容已準備好用於目標應用程式,或共用作業發生錯誤。

適用於