DeviceInformation.CreateWatcher(String, IIterable(String)) | createWatcher(String, IIterable(String)) method

Applies to Windows and Windows Phone

Creates a DeviceWatcher for devices matching the specified Advanced Query Syntax (AQS) string and the specified collection of properties.

Syntax


var deviceWatcher = Windows.Devices.Enumeration.DeviceInformation.createWatcher(aqsFilter, additionalProperties);

Parameters

aqsFilter

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

An AQS string that filters the DeviceInformation objects to enumerate. Typically this string is retrieved from the GetDeviceSelector method of a class that interacts with devices. For example, GetDeviceSelector retrieves the string for the StorageDevice class.

additionalProperties

Type: IIterable<String> [JavaScript/C++] | System.Collections.Generic.IEnumerable<String> [.NET]

An iterable list of additional properties to include in the Properties property of the DeviceInformation objects in the enumeration results. For more info on what the properties represent, see the list of properties in How to retrieve additional properties for a device or PnP object.

Return value

Type: DeviceWatcher

The created DeviceWatcher.

Remarks

The DeviceWatcher first performs an initial enumeration of devices, raising an Added event for each device that it finds, and raising an EnumerationCompleted event when the initial enumeration is complete. After the initial enumeration is complete, it raises events when a device is added, deleted, or updated.

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.

See the DeviceWatcher class for an example.

Requirements

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

DeviceInformation
CreateWatcher
CreateWatcher(DeviceClass)
CreateWatcher(String)

 

 

Show:
© 2014 Microsoft