PnpObject.CreateWatcher 方法

定義

多載

CreateWatcher(PnpObjectType, IIterable<String>)

重要

我們不再建議您使用 Windows.Devices.Enumeration.Pnp 命名空間中的類型。 相反地, Windows.Devices.Enumeration 命名空間中的類型會實作新式且更妥善維護的 Windows.Devices.Enumeration.Pnp功能超集合。

PnpObjectType的替代方法是Windows.Devices.Enumeration.DeviceInformationKind列舉,您可以將其當做參數傳遞至Windows.Devices.Enumeration API。 例如,當您建立PnpObjectWatcher時,不要使用PnpObjectType,而是在建立DeviceWatcher時使用DeviceInformationKind

會傳回 PnpObjectWatcher 物件,用來使用事件列舉集合中的 PnP 物件。

CreateWatcher(PnpObjectType, IIterable<String>, String)

重要

我們不再建議您使用 Windows.Devices.Enumeration.Pnp 命名空間中的類型。 相反地, Windows.Devices.Enumeration 命名空間中的類型會實作新式且更妥善維護的 Windows.Devices.Enumeration.Pnp功能超集合。

PnpObjectType的替代方法是Windows.Devices.Enumeration.DeviceInformationKind列舉,您可以將其當做參數傳遞至Windows.Devices.Enumeration API。 例如,當您建立PnpObjectWatcher時,不要使用PnpObjectType,而是在建立DeviceWatcher時使用DeviceInformationKind

會傳回 PnpObjectWatcher 物件,用來列舉使用事件列舉 PnP 物件的篩選集合。

CreateWatcher(PnpObjectType, IIterable<String>)

重要

我們不再建議您使用 Windows.Devices.Enumeration.Pnp 命名空間中的類型。 相反地, Windows.Devices.Enumeration 命名空間中的類型會實作新式且更妥善維護的 Windows.Devices.Enumeration.Pnp功能超集合。

PnpObjectType的替代方法是Windows.Devices.Enumeration.DeviceInformationKind列舉,您可以將其當做參數傳遞至Windows.Devices.Enumeration API。 例如,當您建立PnpObjectWatcher時,不要使用PnpObjectType,而是在建立DeviceWatcher時使用DeviceInformationKind

會傳回 PnpObjectWatcher 物件,用來使用事件列舉集合中的 PnP 物件。

public:
 static PnpObjectWatcher ^ CreateWatcher(PnpObjectType type, IIterable<Platform::String ^> ^ requestedProperties);
/// [Windows.Foundation.Metadata.Overload("CreateWatcher")]
 static PnpObjectWatcher CreateWatcher(PnpObjectType const& type, IIterable<winrt::hstring> const& requestedProperties);
[Windows.Foundation.Metadata.Overload("CreateWatcher")]
public static PnpObjectWatcher CreateWatcher(PnpObjectType type, IEnumerable<string> requestedProperties);
function createWatcher(type, requestedProperties)
Public Shared Function CreateWatcher (type As PnpObjectType, requestedProperties As IEnumerable(Of String)) As PnpObjectWatcher

參數

type
PnpObjectType

PnpObject的類型。

requestedProperties

IIterable<String>

IEnumerable<String>

IIterable<Platform::String>

IIterable<winrt::hstring>

要在列舉結果中包含的PnpObject物件的Properties屬性中,可逐一列出其他屬性。 如需屬性所代表內容的詳細資訊,請參閱 裝置資訊屬性

傳回

用來列舉集合的 PnpObjectWatcher 物件,方法是註冊事件通知委派,以及發出開始和停止事件通知。

屬性

備註

CreateWatcher 是列舉裝置物件的主要起點方法。 如果用戶端想要累加執行列舉,或想要隨著專案變更而更新結果,用戶端應該使用此 API 來列舉 PnpObject。 例如,如果新增、移除 PnpObject 或其屬性已更新,則用戶端會向傳回的監看員物件註冊事件處理常式,以接收列舉 的 PnpObject 以及後續更新。

另請參閱

適用於

CreateWatcher(PnpObjectType, IIterable<String>, String)

重要

我們不再建議您使用 Windows.Devices.Enumeration.Pnp 命名空間中的類型。 相反地, Windows.Devices.Enumeration 命名空間中的類型會實作新式且更妥善維護的 Windows.Devices.Enumeration.Pnp功能超集合。

PnpObjectType的替代方法是Windows.Devices.Enumeration.DeviceInformationKind列舉,您可以將其當做參數傳遞至Windows.Devices.Enumeration API。 例如,當您建立PnpObjectWatcher時,不要使用PnpObjectType,而是在建立DeviceWatcher時使用DeviceInformationKind

會傳回 PnpObjectWatcher 物件,用來列舉使用事件列舉 PnP 物件的篩選集合。

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

參數

type
PnpObjectType

PnpObject的類型。

requestedProperties

IIterable<String>

IEnumerable<String>

IIterable<Platform::String>

IIterable<winrt::hstring>

要在列舉結果中包含的PnpObject物件的Properties屬性中,可逐一列出其他屬性。 如需屬性所代表內容的詳細資訊,請參閱 裝置資訊屬性

aqsFilter
String

Platform::String

winrt::hstring

AQS 字串,可篩選將傳回的 PnP 物件。 一般而言,這個字串是從與裝置互動之類別的 方法擷取。

傳回

用來列舉集合的 PnpObjectWatcher 物件,方法是註冊事件通知委派,以及發出開始和停止事件通知。

屬性

另請參閱

適用於