PrintTaskSourceRequestedArgs 类

定义

PrintTaskSourceRequestedHandler 委托关联的参数。 提供用于将要打印的内容交给 PrintTask 的方法。

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

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

注解

PrintTaskSourceRequestedArgs 用于设置要打印的内容的源。 下面是 UWP 打印示例中 的代码片段,其中显示了 SetSource 方法:

protected virtual void PrintTaskRequested(PrintManager sender, PrintTaskRequestedEventArgs e)
{
    PrintTask printTask = null;
    printTask = e.Request.CreatePrintTask("C# Printing SDK Sample", sourceRequested =>
    {
        // Print Task event handler is invoked when the print job is completed.
        printTask.Completed += async (s, args) =>
        {
            // Notify the user when the print operation fails.
            if (args.Completion == PrintTaskCompletion.Failed)
            {
                await scenarioPage.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    MainPage.Current.NotifyUser("Failed to print.", NotifyType.ErrorMessage);
                });
            }
        };

        // Call PrintTaskSourceRequestedArgs.SetSource
        sourceRequested.SetSource(printDocumentSource);
    });
}

有关此打印方案和其他打印方案的详细信息,请参阅 打印UWP 打印示例

属性

Deadline

获取 DateTime 对象,该对象指示打印任务源请求的截止时间。

方法

GetDeferral()

获取一个 PrintTaskSourceRequestedDeferral 对象,该对象提供对 Complete 方法的访问权限。 此方法指示延迟已结束。

SetSource(IPrintDocumentSource)

通知要打印的内容的打印任务。

适用于