PnpObjectWatcher.Added 事件

定义

重要

我们不再建议使用 Windows.Devices.Enumeration.Pnp 命名空间中的类型。 相反, Windows.Devices.Enumeration 命名空间中的类型实现了 Windows.Devices.Enumeration.Pnp 功能的新式且维护得更好的超集。

PnpObjectType 的替代方法是 Windows.Devices.Enumeration.DeviceInformationKind 枚举,你可以将其作为参数传递给 Windows.Devices.Enumeration API。 例如,创建 PnpObjectWatcher 时不使用 PnpObjectType,而是在创建 DeviceWatcher 时使用 DeviceInformationKind

将 PnpObject 添加到由 PnpObjectWatcher 枚举的集合时发生。

// Register
event_token Added(TypedEventHandler<PnpObjectWatcher, PnpObject const&> const& handler) const;

// Revoke with event_token
void Added(event_token const* cookie) const;

// Revoke with event_revoker
PnpObjectWatcher::Added_revoker Added(auto_revoke_t, TypedEventHandler<PnpObjectWatcher, PnpObject const&> const& handler) const;
public event TypedEventHandler<PnpObjectWatcher,PnpObject> Added;
function onAdded(eventArgs) { /* Your code */ }
pnpObjectWatcher.addEventListener("added", onAdded);
pnpObjectWatcher.removeEventListener("added", onAdded);
- or -
pnpObjectWatcher.onadded = onAdded;
Public Custom Event Added As TypedEventHandler(Of PnpObjectWatcher, PnpObject) 

事件类型

适用于