public IEnumerable <AutomationElement> Find(AutomationElement element, IList <AutomationElement> collection, CancellationToken cancellationToken) { var input = _element.Find(element, null, cancellationToken); if (_reversed) { input = input.Reverse(); } var condition = _condition as ICondition ?? throw new System.Exception($"PredicateElement condition ({_condition.GetType().Name}) does not implement ICondition."); return(input.Where((e, index) => condition.Matches(e, index))); }
public IEnumerable <AutomationElement> Find(AutomationElement root, IList <AutomationElement> collection, CancellationToken cancellationToken) { //System.Diagnostics.Debug.WriteLine(GetHashCode() + " JoinStep " + collection.Count); return(_left.Find(root, collection, cancellationToken).SelectMany(e => _right.Find(e, null, cancellationToken)));/* * //System.Diagnostics.Debug.WriteLine(GetHashCode() + " JoinStep >> " + left.Count()); * var right = new List<AutomationElement>(); * foreach(var l in left) * { * var r = _right.Find(l, left.ToList()); * if (r.Count() > 0) * { * right.AddRange(r); * } * } * * System.Diagnostics.Debug.WriteLine(GetHashCode() + " JoinStep >> " + right.Count); * return right;*/ }
public IEnumerable <AutomationElement> Find(AutomationElement element, IList <AutomationElement> collection, CancellationToken cancellationToken) { var input = _element.Find(element, null, cancellationToken); if (_reversed) { input = input.Reverse(); } var condition = _condition as ICondition ?? throw new System.Exception($"PredicateElement condition ({_condition.GetType().Name}) does not implement ICondition."); return(input.Where((e, index) => { var matches = condition.Matches(e, index); System.Diagnostics.Debug.WriteLine($"PredicateElement: {e.ToDiagString()} at {index}: match? {matches}"); return matches; })); }
public IEnumerable <AutomationElement> Find(AutomationElement root, CancellationToken cancellationToken) { var collection = new List <AutomationElement>(); return(_xPathExpresion.Find(root, collection, cancellationToken)); }