Exemplo n.º 1
0
        public void Delete(SearchCriterionViewModel searchCriterion)
        {
            if (Criterions.Count == 1)
            {
                Criterions[0].Text = "";
                return;
            }

            Criterions.Remove(searchCriterion);
            _searchTransformer.Update(Criterions);

            //begin hack
            _visualTransformers.Transformers.Remove(_searchTransformer);
            _visualTransformers.Transformers.Add(_searchTransformer);
            //end hack
        }
Exemplo n.º 2
0
        public void Apply(SearchCriterionViewModel searchCriterion)
        {
            //begin hack - random crash
            if (searchCriterion == null)
            {
                return;
            }
            //end hack

            if (Criterions.IndexOf(searchCriterion) < Criterions.Count - 1 && string.IsNullOrEmpty(searchCriterion.Text))
            {
                Criterions.Remove(searchCriterion);
            }

            Refresh();

            var lastElement = Criterions.Last();

            if (!string.IsNullOrEmpty(lastElement.Text))
            {
                Criterions.Add(new SearchCriterionViewModel());
            }
        }