Udostępnij za pośrednictwem


DeviceWatcher.Stop Method

Definition

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

public:
 virtual void Stop() = Stop;
void Stop();
public void Stop();
function stop()
Public Sub Stop ()

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.

Applies to