Winium.StoreApps.CodedUITestProject.WiniumElement.IterFind C# (CSharp) Method

IterFind() public method

public IterFind ( TreeScope scope, Predicate predicate ) : IEnumerable
scope TreeScope
predicate Predicate
return IEnumerable
        public IEnumerable<WiniumElement> IterFind(TreeScope scope, Predicate<WiniumElement> predicate)
        {
            if (scope != TreeScope.Descendants && scope != TreeScope.Children)
            {
                throw new ArgumentException("scope should be one of TreeScope.Descendants or TreeScope.Children");
            }

            var walker = new TreeWalker(Condition.TrueCondition);

            var elementNode = walker.GetFirstChild(this.AutomationElement);

            while (elementNode != null)
            {
                var winiumElement = new WiniumElement(elementNode);

                if (predicate == null || predicate(winiumElement))
                {
                    yield return winiumElement;
                }

                if (scope == TreeScope.Descendants)
                {
                    foreach (var descendant in winiumElement.IterFind(scope, predicate))
                    {
                        yield return descendant;
                    }
                }

                elementNode = walker.GetNextSibling(elementNode);
            }
        }

Usage Example

コード例 #1
0
        public IEnumerable <WiniumElement> IterFind(TreeScope scope, Predicate <WiniumElement> predicate)
        {
            if (scope != TreeScope.Descendants && scope != TreeScope.Children)
            {
                throw new ArgumentException("scope should be one of TreeScope.Descendants or TreeScope.Children");
            }

            var walker = new TreeWalker(Condition.TrueCondition);

            var elementNode = walker.GetFirstChild(this.AutomationElement);

            while (elementNode != null)
            {
                var winiumElement = new WiniumElement(elementNode);

                if (predicate == null || predicate(winiumElement))
                {
                    yield return(winiumElement);
                }

                if (scope == TreeScope.Descendants)
                {
                    foreach (var descendant in winiumElement.IterFind(scope, predicate))
                    {
                        yield return(descendant);
                    }
                }

                elementNode = walker.GetNextSibling(elementNode);
            }
        }
All Usage Examples Of Winium.StoreApps.CodedUITestProject.WiniumElement::IterFind