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); }
/// <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(); }
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); }
/// <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); }
private void AddFilterRuleInternal(FilterRulePanelItem item) { Debug.Assert(null != item); FilterRulePanelItem newItem = new FilterRulePanelItem(item.Rule.DeepCopy(), item.GroupId); this.Controller.AddFilterRulePanelItem(newItem); }
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; }
/// <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(); }
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; }
/// <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(); }
/// <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; }