AutomationPeer.ListenerExists(AutomationEvents) 方法

定義

取得值,這個值表示消費者介面自動化是否正在接聽指定的事件。

public:
 static bool ListenerExists(System::Windows::Automation::Peers::AutomationEvents eventId);
public static bool ListenerExists (System.Windows.Automation.Peers.AutomationEvents eventId);
static member ListenerExists : System.Windows.Automation.Peers.AutomationEvents -> bool
Public Shared Function ListenerExists (eventId As AutomationEvents) As Boolean

參數

eventId
AutomationEvents

其中一個列舉值。

傳回

Boolean

boolean 指出消費者介面自動化是否正在接聽事件。

備註

一般而言,您會在建立 AutomationPeer 引發事件的 之前呼叫這個方法。 此方法是效能量值,因為如果消費者介面自動化未接聽事件,則建立對等來引發事件並不合理。

注意

這個方法是靜態的,只有在委派接聽消費者介面自動化中指定的事件時,才有答案,而不是特定專案上的事件。 消費者介面自動化可以建立廣播接聽程式,因此個別元素資訊無關。

適用於

另請參閱