/// <summary> /// Initializes a new instance of the ContentFilterCollection class, containing elements /// copied from an array. /// </summary> /// <param name="items"> /// The array whose elements are to be added to the new ContentFilterCollection. /// </param> public ContentFilterCollection(ContentFilter[] items) { this.AddRange(items); }
/// <summary> /// Inserts an element into the ContentFilterCollection at the specified index /// </summary> /// <param name="index"> /// The index at which the ContentFilter is to be inserted. /// </param> /// <param name="value"> /// The ContentFilter to insert. /// </param> public virtual void Insert(int index, ContentFilter value) { this.List.Insert(index, value); }
/// <summary> /// Removes the first occurrence of a specific ContentFilter from this ContentFilterCollection. /// </summary> /// <param name="value"> /// The ContentFilter value to remove from this ContentFilterCollection. /// </param> public virtual void Remove(ContentFilter value) { this.List.Remove(value); }
/// <summary> /// Return the zero-based index of the first occurrence of a specific value /// in this ContentFilterCollection /// </summary> /// <param name="value"> /// The ContentFilter value to locate in the ContentFilterCollection. /// </param> /// <returns> /// The zero-based index of the first occurrence of the _ELEMENT value if found; /// -1 otherwise. /// </returns> public virtual int IndexOf(ContentFilter value) { return this.List.IndexOf(value); }
/// <summary> /// Determines whether a specfic ContentFilter value is in this ContentFilterCollection. /// </summary> /// <param name="value"> /// The ContentFilter value to locate in this ContentFilterCollection. /// </param> /// <returns> /// true if value is found in this ContentFilterCollection; /// false otherwise. /// </returns> public virtual bool Contains(ContentFilter value) { return this.List.Contains(value); }
/// <summary> /// Adds the elements of an array to the end of this ContentFilterCollection. /// </summary> /// <param name="items"> /// The array whose elements are to be added to the end of this ContentFilterCollection. /// </param> public virtual void AddRange(ContentFilter[] items) { foreach (ContentFilter item in items) { this.List.Add(item); } }
/// <summary> /// Adds an instance of type ContentFilter to the end of this ContentFilterCollection. /// </summary> /// <param name="value"> /// The ContentFilter to be added to the end of this ContentFilterCollection. /// </param> public virtual void Add(ContentFilter value) { this.List.Add(value); }
private void contentFiltersGrid_ItemCommand(object source, DataGridCommandEventArgs e) { if ( e.CommandName == "AddItem" ) { ContentFilter newFilter = new ContentFilter(); newFilter.Expression = "New Expression"; contentFilters.Insert(0,newFilter); contentFiltersGrid.CurrentPageIndex = 0; contentFiltersGrid.EditItemIndex = 0; UpdateTestBox(); BindGrid(); } else if ( e.CommandName == "MoveUp" && e.Item != null ) { int position = e.Item.DataSetIndex; if ( position > 0 ) { ContentFilter filter = contentFilters[position]; contentFilters.RemoveAt( position ); contentFilters.Insert( position-1, filter ); contentFiltersGrid.CurrentPageIndex = (position-1) / contentFiltersGrid.PageSize; if ( contentFiltersGrid.EditItemIndex == position ) { contentFiltersGrid.EditItemIndex = position - 1; } else if ( contentFiltersGrid.EditItemIndex == position - 1) { contentFiltersGrid.EditItemIndex = position; } changesAlert.Visible = true; } UpdateTestBox(); BindGrid(); } else if ( e.CommandName == "MoveDown" && e.Item != null ) { int position = e.Item.DataSetIndex; if ( position < contentFilters.Count-1 ) { ContentFilter filter = contentFilters[position]; contentFilters.RemoveAt( position ); contentFilters.Insert( position+1, filter ); contentFiltersGrid.CurrentPageIndex = (position+1) / contentFiltersGrid.PageSize; if ( contentFiltersGrid.EditItemIndex == position ) { contentFiltersGrid.EditItemIndex = position + 1; } else if ( contentFiltersGrid.EditItemIndex == position + 1) { contentFiltersGrid.EditItemIndex = position; } changesAlert.Visible = true; } UpdateTestBox(); BindGrid(); } }