private void OnStructureChange(object sender, StructureChangedEventArgs e) { Console.WriteLine($"OnStructureChange {e.StructureChangeType}, {e.EventId}, {e.GetRuntimeId()}"); var automationElement = AutomationElement.FromHandle(_process.MainWindowHandle); _automationElements = automationElement.FindAll(TreeScope.Subtree, Condition.TrueCondition); }
private void HandleStructureChangedEvent(object sender, UIA.StructureChangedEventArgs structureChangedEventArgs) { var basicAutomationElement = new UIA2BasicAutomationElement((UIA2Automation)Automation, (UIA.AutomationElement)sender); var senderElement = new AutomationElement(basicAutomationElement); HandleStructureChangedEvent(senderElement, (StructureChangeType)structureChangedEventArgs.StructureChangeType, structureChangedEventArgs.GetRuntimeId()); }