private IUIItem Create(ContainerItemFactory containerItemFactory, SearchCriteria searchCriteria, ActionListener actionListener) { IUIItem item = containerItemFactory.Get(searchCriteria, actionListener); if (item == null) return null; windowItemsMap.Add(item.Location, searchCriteria); return item; }
public virtual IUIItem Get(ContainerItemFactory containerItemFactory, SearchCriteria searchCriteria, ActionListener actionListener) { logger.DebugFormat("Finding item based on criteria: ({0}) on ({1})", searchCriteria, initializeOption.Identifier); Point location = windowItemsMap.GetItemLocation(searchCriteria); if (location.Equals(RectX.UnlikelyWindowPosition)) { logger.Debug("[PositionBasedSearch] Could not find based on position, finding using search."); return Create(containerItemFactory, searchCriteria, actionListener); } AutomationElement automationElement = AutomationElementX.GetAutomationElementFromPoint(location); if (automationElement != null && searchCriteria.AppliesTo(automationElement)) { IUIItem item = new DictionaryMappedItemFactory().Create(automationElement, actionListener, searchCriteria.CustomItemType); return UIItemProxyFactory.Create(item, actionListener); } logger.DebugFormat("[PositionBasedSearch] UIItem {0} changed its position, finding using search.", searchCriteria); return Create(containerItemFactory, searchCriteria, actionListener); }
public override IUIItem Get(ContainerItemFactory containerItemFactory, SearchCriteria searchCriteria, IActionListener actionListener) { return containerItemFactory.Get(searchCriteria, actionListener); }