PrintNotificationEventDetails 类

定义

包含允许客户端访问和/或操作打印事件数据和打印设备名称信息的属性。

public ref class PrintNotificationEventDetails sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Devices.Printers.Extensions.ExtensionsContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class PrintNotificationEventDetails final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Devices.Printers.Extensions.ExtensionsContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class PrintNotificationEventDetails
Public NotInheritable Class PrintNotificationEventDetails
继承
Object IInspectable PrintNotificationEventDetails
属性

Windows 要求

设备系列
Windows Desktop Extension SDK (在 10.0.10240.0 中引入)
API contract
Windows.Devices.Printers.Extensions.ExtensionsContract (在 v1.0 中引入)

注解

后台任务处理程序可以使用本地存储保存 PrintNotificationEventDetails 类的 PrinterNameEventData 值,以便以后应用可以使用这些信息。

// Save the printer name and asyncUI xml
//
var keyPrinterName = "BA5857FA-DE2C-4A4A-BEF2-49D8B4130A39";
var keyAsyncUIXML = "55DCA47A-BEE9-43EB-A7C8-92ECA2FA0685";
var settings = Windows.Storage.ApplicationData.current.localSettings;

//
// The background task instance's activation parameters are available
// via Windows.UI.WebUI.WebUIBackgroundTaskInstance.current
//
var backgroundTaskInstance = Windows.UI.WebUI.WebUIBackgroundTaskInstance.current;

// Save data into a user-defined var, "settings" 
var details = backgroundTaskInstance.triggerDetails;
settings.values[keyPrinterName] = details.printerName;
settings.values[keyAsyncUIXML] = details.eventData;

// Save directly into PrintNotificationEventDetails
Windows.Devices.Printers.Extensions.PrintNotificationEventDetails = details;

有关使用 PrintNotificationEventDetails 类的详细信息,请参阅硬件开发人员中心上 打印机的 UWP 设备应用 主题。

属性

EventData

获取或设置打印通知事件的事件数据。

PrinterName

获取与打印通知关联的打印设备的名称。

适用于

另请参阅