Delen via


DeviceWatcher.Added Event

Definition

Event that is raised when a device is added to the collection enumerated by the DeviceWatcher.

// Register
event_token Added(TypedEventHandler<DeviceWatcher, DeviceInformation const&> const& handler) const;

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

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

Event Type

Remarks

Note

An app must subscribe to all of the added, removed, and updated events to be notified when there are device additions, removals or updates. If an app handles only the added event, it will not receive an update if a device is added to the system after the initial device enumeration completes.

Applies to

See also