PnpObjectWatcher.Start Method

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.

Starts raising the events to inform the client that a PnpObject has been added, updated, or removed.

public:
 virtual void Start() = Start;
void Start();
public void Start();
function start()
Public Sub Start ()

Remarks

An app calls Start to begin the search for devices. During this initial enumeration, the PnpObjectWatcher raises an Added event for each device that's found, until all devices are found. The PnpObjectWatcher raises an EnumerationCompleted event when the initial enumeration is complete, and continues to raise events if a device is added, updated, or removed.

The Start method can only be called when the PnpObjectWatcher is in the Created, Stopped or Aborted state. The Status property indicates the PnpObjectWatcher state. When re-starting the watcher, wait for the Stopped event before calling Start.

The following diagram shows how the PnpObjectWatcher transitions between the states represented by DeviceWatcherStatus enumeration.

state diagram of DeviceWatcher states

Applies to