Ejemplo n.º 1
0
        protected virtual TItem GetItem(string name, Expression <Func <TItem, bool> > predicateExpression)
        {
            var predicate = predicateExpression.Compile();

            ControlListScopeLocator scopeLocator = new ControlListScopeLocator(searchOptions =>
            {
                return(GetItemElements(searchOptions).
                       Where(element => predicate(CreateItem(new DefinedScopeLocator(element), name))));
            });

            return(CreateItem(scopeLocator, name));
        }
Ejemplo n.º 2
0
        protected virtual TItem GetItem(string name, Expression <Func <TItem, bool> > predicateExpression)
        {
            By  itemBy    = CreateItemBy();
            var predicate = predicateExpression.Compile();

            ControlListScopeLocator scopeLocator = new ControlListScopeLocator(options =>
            {
                return(GetItemElements(itemBy.With(options).SafelyAtOnce()).
                       Where(element => predicate(CreateItem(new DefinedScopeLocator(element), name))));
            });

            return(CreateItem(scopeLocator, name));
        }