public virtual IUIItem Create(SearchCriteria searchCriteria, ActionListener actionListener)
 {
     if (searchCriteria.IsIndexed)
     {
         UIItemCollection collection = CreateAll(searchCriteria, actionListener);
         return(searchCriteria.IndexedItem(collection));
     }
     return(dictionaryMappedItemFactory.Create(finder.Descendant(searchCriteria.AutomationCondition), actionListener,
                                               searchCriteria.CustomItemType));
 }
Beispiel #2
0
        public virtual UIItemCollection ItemsWithin(Rect bounds, ActionListener actionListener)
        {
            var collection = new UIItemCollection();
            List<AutomationElement> descendants = Finder.Descendants(AutomationSearchCondition.All);
            foreach (AutomationElement automationElement in descendants)
            {
                if (!bounds.Contains(automationElement.Current.BoundingRectangle)) continue;

                var factory = new DictionaryMappedItemFactory();
                collection.Add(factory.Create(automationElement, actionListener));
            }
            return collection;
        }
        public virtual UIItemCollection ItemsWithin(Rect bounds, ActionListener actionListener)
        {
            var collection = new UIItemCollection();
            List <AutomationElement> descendants = finder.Descendants(AutomationSearchCondition.All);

            foreach (AutomationElement automationElement in descendants)
            {
                if (!bounds.Contains(automationElement.Current.BoundingRectangle))
                {
                    continue;
                }

                var factory = new DictionaryMappedItemFactory();
                collection.Add(factory.Create(automationElement, actionListener));
            }
            return(collection);
        }