Bagikan melalui


PrintTaskSourceRequestedArgs Kelas

Definisi

Argumen yang terkait dengan delegasi PrintTaskSourceRequestedHandler . Menyediakan metode untuk menyerahkan konten yang akan dicetak ke 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
Warisan
Object Platform::Object IInspectable PrintTaskSourceRequestedArgs
Atribut

Persyaratan Windows

Rangkaian perangkat
Windows 10 (diperkenalkan dalam 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (diperkenalkan dalam v1.0)

Keterangan

PrintTaskSourceRequestedArgs digunakan untuk mengatur sumber konten yang akan dicetak. Berikut adalah cuplikan kode dari sampel cetak UWP yang menunjukkan metode 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);
    });
}

Untuk informasi selengkapnya tentang skenario pencetakan ini dan lainnya, lihat Mencetak dan sampel cetak UWP.

Properti

Deadline

Mendapatkan objek DateTime yang menunjukkan tenggat waktu untuk permintaan sumber tugas cetak.

Metode

GetDeferral()

Mendapatkan objek PrintTaskSourceRequestedDeferral yang menyediakan akses ke metode Lengkap . Metode ini menunjukkan bahwa penolakan akan berakhir.

SetSource(IPrintDocumentSource)

Menginformasikan tugas cetak isi yang akan dicetak.

Berlaku untuk