Example #1
0
        private IEnumerable <Control> FindMatchingControls(Component searchRoot, SelectorPathNode path, Selector selector)
        {
            path = new SelectorPathNode()
            {
                Prev = path, Control = searchRoot
            };

            if (selector.MatchControl(searchRoot, path))
            {
                yield return(searchRoot);
            }

            foreach (var control in Children)
            {
                if (control is Component component)
                {
                    foreach (var subControl in component.FindMatchingControls(component, path, selector))
                    {
                        yield return(subControl);
                    }
                }

                if (selector.MatchControl(control, path))
                {
                    yield return(control);
                }
            }
        }
Example #2
0
        protected override bool Match(Control control, SelectorPathNode path)
        {
            if (control.Classes.Count == 0)
            {
                return(false);
            }

            return(_classes.Any(clazz => control.Classes.Contains(clazz)));
        }
Example #3
0
        protected override bool Match(Control control, SelectorPathNode path)
        {
            if (control.Parent == null)
            {
                return(false);
            }

            return(_parentSelector.MatchControl(control.Parent, path.Prev) &&
                   _selector.MatchControl(control, path));
        }
Example #4
0
 protected override bool Match(Control control, SelectorPathNode path)
 {
     return(_chainOperator switch
     {
         ChainOperator.And => _prevSelector.MatchControl(control, path) &&
         _nextSelector.MatchControl(control, path),
         ChainOperator.Or => _prevSelector.MatchControl(control, path) ||
         _nextSelector.MatchControl(control, path),
         ChainOperator.Xor => _prevSelector.MatchControl(control, path) !=
         _nextSelector.MatchControl(control, path),
         _ => throw new ArgumentException("Invalid chain operator.")
     });
Example #5
0
 protected override bool Match(Control control, SelectorPathNode path)
 {
     return(_parentSelector.MatchControl(control, path) && _condition(control, path));
 }
Example #6
0
 protected abstract bool Match(Control control, SelectorPathNode path);
Example #7
0
 internal bool MatchControl(Control control, SelectorPathNode path) => Match(control, path);
Example #8
0
 protected override bool Match(Control control, SelectorPathNode path)
 {
     return(control.Id == null ? false : _ids.Contains(control.Id));
 }
Example #9
0
 protected override bool Match(Control control, SelectorPathNode path)
 {
     return(!_selector.MatchControl(control, path));
 }
Example #10
0
 protected override bool Match(Control control, SelectorPathNode path)
 {
     return(_types.Contains(control.GetType()));
 }