AutomationInteropProvider.ClientsAreListening Właściwość
Definicja
Pobiera wartość określającą, czy jakakolwiek aplikacja klienta automatyzacji interfejsu użytkownika jest subskrybowana do Automatyzacja interfejsu użytkownikaUI Automation zdarzeń.Gets a value that specifies whether any UI Automation client application is subscribed to Automatyzacja interfejsu użytkownikaUI Automation events.
public:
static property bool ClientsAreListening { bool get(); };
public static bool ClientsAreListening { get; }
member this.ClientsAreListening : bool
Public Shared ReadOnly Property ClientsAreListening As Boolean
Wartość właściwości
true
Jeśli klient subskrybuje zdarzenia; w przeciwnym razie false
.true
if a client is subscribed to events; otherwise false
.
Przykłady
/// <summary>
/// Raises an event when a control is invoked.
/// </summary>
/// <param name="provider">The UI Automation provider for the control.</param>
private void RaiseInvokeEvent(IRawElementProviderSimple provider)
{
if (AutomationInteropProvider.ClientsAreListening)
{
AutomationEventArgs args =
new AutomationEventArgs(InvokePatternIdentifiers.InvokedEvent);
AutomationInteropProvider.RaiseAutomationEvent(InvokePatternIdentifiers.InvokedEvent,
provider, args);
}
}
''' <summary>
''' Raises an event when a control is invoked.
''' </summary>
''' <param name="provider">The UI Automation provider for the control.</param>
Private Sub RaiseInvokeEvent(ByVal provider As IRawElementProviderSimple)
If AutomationInteropProvider.ClientsAreListening Then
Dim args As New AutomationEventArgs(InvokePatternIdentifiers.InvokedEvent)
AutomationInteropProvider.RaiseAutomationEvent(InvokePatternIdentifiers.InvokedEvent, provider, args)
End If
End Sub