Share via


PnpObjectWatcher.Added Event

Definition

Important

We no longer recommend that you use the types in the Windows.Devices.Enumeration.Pnp namespace. Instead, the types in the Windows.Devices.Enumeration namespace implement a modern, and better maintained, superset of the functionality of Windows.Devices.Enumeration.Pnp.

The alternative to PnpObjectType is the Windows.Devices.Enumeration.DeviceInformationKind enum, which you can pass as a parameter to Windows.Devices.Enumeration APIs. For example, instead of using PnpObjectType when you create a PnpObjectWatcher, use DeviceInformationKind when you create a DeviceWatcher.

Occurs when a PnpObject is added to the collection enumerated by the 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) 

Event Type

Applies to