Automation.UI.Tree.SearchEngines.TreeWalkerSearchEngine.GetAllResults C# (CSharp) Метод

GetAllResults() публичный Метод

Gets all the automation elements found using the condition specified in the specified query.
public GetAllResults ( Query query, System.TimeSpan timeout ) : IEnumerable
query Query The query.
timeout System.TimeSpan The maximum amount of time to wait for at least one element to become available.
Результат IEnumerable
        public override IEnumerable GetAllResults(Query query, TimeSpan timeout)
        {
            Debug.WriteLine("AllResults - " + query, "UIAutomation-SearchEngine-TreeWalker");

            var root = query.Root;
            var scope = query.Scope;
            var conditions = query.Conditions;
            var results = new ArrayList();
            // The callback for saving all matched elements.
            var saveMatchingChildren = new WithElementCallback(child => {
                Trace.WriteLine("Checking " + AutomationElementHelper.ToString(child) + "...", "UIAutomation-SearchEngine-TreeWalker");
                if (ConditionHelper.IsMeetsRequirements(conditions, child))
                    results.Add(child);
                return null;
            });
            // Execute based on scope.
            switch (scope) {
                case TreeScope.Children:
                    ExecuteWithChildren(root, saveMatchingChildren);
                    return results;
                case TreeScope.Descendants:
                    ExecuteWithDescendants(root, saveMatchingChildren);
                    return results;
                default:
                    throw new NotSupportedException("Scope '" + scope + "' is not supported for TreeWalker search engines");
            }
        }