作者:VB.NET开发
项目:System.Windows.Automation.Provide
''' <summary>
''' Responds to an addition to the UI Automation tree structure by raising an event.
''' </summary>
''' <param name="list">
''' The list to which the item was added.
''' </param>
''' <remarks>
''' For the runtime Id of the item, pass 0 because the provider cannot know
''' what its actual runtime Id is.
''' </remarks>
Public Shared Sub OnStructureChangeAdd(ByVal list As CustomListControl)
If AutomationInteropProvider.ClientsAreListening Then
Dim fakeRuntimeId(1) As Integer
fakeRuntimeId(0) = 0
Dim args As New StructureChangedEventArgs( _
StructureChangeType.ChildrenBulkAdded, fakeRuntimeId)
AutomationInteropProvider.RaiseStructureChangedEvent( _
CType(list.Provider, IRawElementProviderSimple), args)
End If
End Sub
''' <summary>
''' Responds to a removal from the UI Automation tree structure by raising an event.
''' </summary>
''' <param name="list">
''' The list from which the item was removed.
''' </param>
''' <remarks>
''' For the runtime Id of the list, pass 0 because the provider cannot know
''' what its actual runtime ID is.
''' </remarks>
Public Shared Sub OnStructureChangeRemove(ByVal list As CustomListControl)
If AutomationInteropProvider.ClientsAreListening Then
Dim fakeRuntimeId(1) As Integer
fakeRuntimeId(0) = 0
Dim args As New StructureChangedEventArgs( _
StructureChangeType.ChildrenBulkRemoved, fakeRuntimeId)
AutomationInteropProvider.RaiseStructureChangedEvent( _
CType(list.Provider, IRawElementProviderSimple), args)
End If
End Sub