Stop | stop method

DeviceWatcher.Stop | stop method

Stop raising the events that add, update and remove enumeration results.

Syntax


deviceWatcher.stop();

Parameters

This method has no parameters.

Remarks

To stop a search for devices, an app calls Stop and enters the Stopping state. The Stopped event is raised when the Stop operation completes and the DeviceWatcher enters the Stopped state.

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

state diagram of DeviceWatcher states

This call transitions the DeviceWatcher to the Stopping state and completes immediately. The watcher will transition to the Stopped state once all events that are already in the process of being raised have completed.

Callers may wait for the Stopped event if they need to know when the DeviceWatcher has stopped. Callers must wait for the Stopped event before they can call Start to restart the watcher. Callers may unsubscribe from events if they do not want to receive any additional events after Stop but do not want to wait for the Stopped event.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Devices.Enumeration
Windows::Devices::Enumeration [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Devices.Enumeration
Windows::Devices::Enumeration [C++]

Metadata

Windows.winmd

See also

DeviceWatcher

 

 

Show:
© 2016 Microsoft