DeviceInformation.CreateWatcher Method

Definition

Overloads

CreateWatcher()

Creates a DeviceWatcher for all devices.

CreateWatcher(String)

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

CreateWatcher(DeviceClass)

Creates a DeviceWatcher for devices matching the specified DeviceClass.

CreateWatcher(String, IEnumerable<String>)

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

CreateWatcher(String, IEnumerable<String>, DeviceInformationKind)

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

CreateWatcher()

Creates a DeviceWatcher for all devices.

public:
 static DeviceWatcher ^ CreateWatcher();
 static DeviceWatcher CreateWatcher();
[Windows.Foundation.Metadata.Overload("CreateWatcher")]
public static DeviceWatcher CreateWatcher();
function createWatcher()
Public Shared Function CreateWatcher () As DeviceWatcher

Returns

DeviceWatcher

The created DeviceWatcher.

Attributes

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.

See the DeviceWatcher class for an example.

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 also

CreateWatcher(String)

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

public:
 static DeviceWatcher ^ CreateWatcher(Platform::String ^ aqsFilter);
 static DeviceWatcher CreateWatcher(winrt::hstring const & aqsFilter);
[Windows.Foundation.Metadata.Overload("CreateWatcherAqsFilter")]
public static DeviceWatcher CreateWatcher(string aqsFilter);
function createWatcher(aqsFilter)
Public Shared Function CreateWatcher (aqsFilter As String) As DeviceWatcher

Parameters

aqsFilter
String

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.

Returns

DeviceWatcher

The created DeviceWatcher.

Attributes

Remarks

Note

This overload is not available from JavaScript. To create a DeviceWatcher from an AQS string in JavaScript, use the CreateWatcher(String, IIterable_1) overload and pass null as the second parameter.

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.

See also

CreateWatcher(DeviceClass)

Creates a DeviceWatcher for devices matching the specified DeviceClass.

public:
 static DeviceWatcher ^ CreateWatcher(DeviceClass deviceClass);
 static DeviceWatcher CreateWatcher(DeviceClass deviceClass);
[Windows.Foundation.Metadata.DefaultOverload]
[Windows.Foundation.Metadata.Overload("CreateWatcherDeviceClass")]
public static DeviceWatcher CreateWatcher(DeviceClass deviceClass);
function createWatcher(deviceClass)
Public Shared Function CreateWatcher (deviceClass As DeviceClass) As DeviceWatcher

Parameters

deviceClass
DeviceClass

The class of device to enumerate using the DeviceWatcher.

Returns

DeviceWatcher

The created DeviceWatcher.

Attributes

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.

See also

CreateWatcher(String, IEnumerable<String>)

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

public:
 static DeviceWatcher ^ CreateWatcher(Platform::String ^ aqsFilter, IIterable<Platform::String ^> ^ additionalProperties);
 static DeviceWatcher CreateWatcher(winrt::hstring const & aqsFilter, IIterable<winrt::hstring> const & additionalProperties);
[Windows.Foundation.Metadata.Overload("CreateWatcherAqsFilterAndAdditionalProperties")]
public static DeviceWatcher CreateWatcher(string aqsFilter, IEnumerable<string> additionalProperties);
function createWatcher(aqsFilter, additionalProperties)
Public Shared Function CreateWatcher (aqsFilter As String, additionalProperties As IEnumerable(Of String)) As DeviceWatcher

Parameters

aqsFilter
String

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
IEnumerable<String>

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 Device information properties.

Returns

DeviceWatcher

The created DeviceWatcher.

Attributes

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.

See also

CreateWatcher(String, IEnumerable<String>, DeviceInformationKind)

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

public:
 static DeviceWatcher ^ CreateWatcher(Platform::String ^ aqsFilter, IIterable<Platform::String ^> ^ additionalProperties, DeviceInformationKind kind);
 static DeviceWatcher CreateWatcher(winrt::hstring const & aqsFilter, IIterable<winrt::hstring> const & additionalProperties, DeviceInformationKind kind);
[Windows.Foundation.Metadata.Overload("CreateWatcherWithKindAqsFilterAndAdditionalProperties")]
public static DeviceWatcher CreateWatcher(string aqsFilter, IEnumerable<string> additionalProperties, DeviceInformationKind kind);
function createWatcher(aqsFilter, additionalProperties, kind)
Public Shared Function CreateWatcher (aqsFilter As String, additionalProperties As IEnumerable(Of String), kind As DeviceInformationKind) As DeviceWatcher

Parameters

aqsFilter
String

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
IEnumerable<String>

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 Device information properties.

kind
DeviceInformationKind

The specific types of devices the DeviceWatcher is interested in.

Returns

DeviceWatcher

The created DeviceWatcher.

Attributes

See also

Applies to