AutomationInteropProvider.ClientsAreListening Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a value that specifies whether any UI Automation client application is subscribed to UI Automation events.
public:
static property bool ClientsAreListening { bool get(); };
public static bool ClientsAreListening { get; }
static member ClientsAreListening : bool
Public Shared ReadOnly Property ClientsAreListening As Boolean
Property Value
true
if a client is subscribed to events; otherwise false
.
Examples
/// <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
Applies to
See also
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.