partial void OnAddRulesExecutedImplementation(ExecutedRoutedEventArgs e)
        {
            Debug.Assert(e != null, "not null");

            if (e.Parameter == null)
            {
                throw new ArgumentException("e.Parameter is null.", "e");
            }

            List <FilterRulePanelItem> itemsToAdd = new List <FilterRulePanelItem>();

            IList selectedItems = (IList)e.Parameter;

            foreach (object item in selectedItems)
            {
                FilterRulePanelItem newItem = item as FilterRulePanelItem;
                if (newItem == null)
                {
                    throw new ArgumentException(
                              "e.Parameter contains a value which is not a valid FilterRulePanelItem object.",
                              "e");
                }

                itemsToAdd.Add(newItem);
            }

            foreach (FilterRulePanelItem item in itemsToAdd)
            {
                this.AddFilterRuleInternal(item);
            }
        }
        private void AddFilterRuleInternal(FilterRulePanelItem item)
        {
            Debug.Assert(item != null, "not null");

            FilterRulePanelItem newItem = new FilterRulePanelItem(item.Rule.DeepCopy(), item.GroupId);

            this.Controller.AddFilterRulePanelItem(newItem);
        }
示例#3
0
        /// <summary>
        /// Removes an item from the panel.
        /// </summary>
        /// <param name="item">
        /// The item to remove.
        /// </param>
        public void RemoveFilterRulePanelItem(FilterRulePanelItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            item.Rule.EvaluationResultInvalidated -= new EventHandler(this.Rule_EvaluationResultInvalidated);

            this.filterRulePanelItems.Remove(item);
            this.UpdateFilterRulePanelItemTypes();

            this.NotifyFilterExpressionChanged();
        }
示例#4
0
        private int GetInsertionIndex(FilterRulePanelItem item)
        {
            Debug.Assert(item != null, "not null");

            for (int i = this.filterRulePanelItems.Count - 1; i >= 0; i--)
            {
                string uniqueId = this.filterRulePanelItems[i].GroupId;
                if (uniqueId.Equals(item.GroupId, StringComparison.Ordinal))
                {
                    return(i + 1);
                }
            }

            return(this.filterRulePanelItems.Count);
        }
示例#5
0
        /// <summary>
        /// Adds an item to the panel.
        /// </summary>
        /// <param name="item">
        /// The item to add.
        /// </param>
        public void AddFilterRulePanelItem(FilterRulePanelItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            int insertionIndex = this.GetInsertionIndex(item);

            this.filterRulePanelItems.Insert(insertionIndex, item);

            item.Rule.EvaluationResultInvalidated += new EventHandler(this.Rule_EvaluationResultInvalidated);

            this.UpdateFilterRulePanelItemTypes();

            this.NotifyFilterExpressionChanged();
        }
        partial void OnRemoveRuleExecutedImplementation(ExecutedRoutedEventArgs e)
        {
            Debug.Assert(e != null, "not null");

            if (e.Parameter == null)
            {
                throw new ArgumentException("e.Parameter is null.", "e");
            }

            FilterRulePanelItem item = e.Parameter as FilterRulePanelItem;

            if (item == null)
            {
                throw new ArgumentException("e.Parameter is not a valid FilterRulePanelItem object.", "e");
            }

            this.RemoveFilterRuleInternal(item);
        }
 private void RemoveFilterRuleInternal(FilterRulePanelItem item)
 {
     Debug.Assert(item != null, "not null");
     this.Controller.RemoveFilterRulePanelItem(item);
 }
示例#8
0
        private void AddFilterRuleInternal(FilterRulePanelItem item)
        {
            Debug.Assert(null != item);

            FilterRulePanelItem newItem = new FilterRulePanelItem(item.Rule.DeepCopy(), item.GroupId);
            this.Controller.AddFilterRulePanelItem(newItem);
        }
示例#9
0
 private void RemoveFilterRuleInternal(FilterRulePanelItem item)
 {
     Debug.Assert(null != item);
     this.Controller.RemoveFilterRulePanelItem(item);
 }
 /// <summary>
 /// Initializes a new instance of the FilterRulePanelItem class.
 /// </summary>
 /// <param name="filterRule">
 /// The FilterRulePanelItem that will be added to the FilterRulePanel.
 /// </param>
 public AddFilterRulePickerItem(FilterRulePanelItem filterRule)
 {
     this.FilterRule = filterRule;
 }
示例#11
0
        /// <summary>
        /// Adds an item to the panel.
        /// </summary>
        /// <param name="item">
        /// The item to add.
        /// </param>
        public void AddFilterRulePanelItem(FilterRulePanelItem item)
        {
            if (null == item)
            {
                throw new ArgumentNullException("item");
            }

            int insertionIndex = this.GetInsertionIndex(item);
            this.filterRulePanelItems.Insert(insertionIndex, item);

            item.Rule.EvaluationResultInvalidated += new EventHandler(this.Rule_EvaluationResultInvalidated);

            this.UpdateFilterRulePanelItemTypes();

            this.NotifyFilterExpressionChanged();
        }
示例#12
0
        private int GetInsertionIndex(FilterRulePanelItem item)
        {
            Debug.Assert(null != item);

            for (int i = this.filterRulePanelItems.Count - 1; i >= 0; i--)
            {
                string uniqueId = this.filterRulePanelItems[i].GroupId;
                if (uniqueId.Equals(item.GroupId, StringComparison.Ordinal))
                {
                    return i + 1;
                }
            }

            return this.filterRulePanelItems.Count;
        }
示例#13
0
        /// <summary>
        /// Removes an item from the panel.
        /// </summary>
        /// <param name="item">
        /// The item to remove.
        /// </param>
        public void RemoveFilterRulePanelItem(FilterRulePanelItem item)
        {
            if (null == item)
            {
                throw new ArgumentNullException("item");
            }

            item.Rule.EvaluationResultInvalidated -= new EventHandler(this.Rule_EvaluationResultInvalidated);

            this.filterRulePanelItems.Remove(item);
            this.UpdateFilterRulePanelItemTypes();

            this.NotifyFilterExpressionChanged();
        }
示例#14
0
 /// <summary>
 /// Initializes a new instance of the FilterRulePanelItem class.
 /// </summary>
 /// <param name="filterRule">
 /// The FilterRulePanelItem that will be added to the FilterRulePanel.
 /// </param>
 public AddFilterRulePickerItem(FilterRulePanelItem filterRule)
 {
     this.FilterRule = filterRule;
 }