/// <summary> /// /// </summary> /// <param name="descriptionCollection"></param> public void ApplySort(ListSortDescriptionCollection descriptionCollection) { _logger.Log("ApplySort - ListSortDescriptionCollection ", LogCategory.Info); SortDescriptions = descriptionCollection; ViewOfBusinessObjectCollection.Sort(new GenericComparer <T>(SortDescriptions)); OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1)); }
/// <summary> /// Removes the first occurrence of a specific object from the <see cref="IBusinessObjectCollection"/>. /// </summary> /// <param name="value">The object to remove from the <see cref="IBusinessObjectCollection"/>.</param> public void Remove(object value) { var index = IndexOf(value); ViewOfBusinessObjectCollection.Remove((T)value); FireListChanged(ListChangedType.ItemDeleted, index); }
/// <summary> /// Determines whether the <see cref="IBusinessObjectCollection"/> contains a specific <see cref="BusinessObject"/>. /// </summary> /// <param name="value">The object to locate in the collection.</param> /// <returns>True if the object is found in the collection; otherwise, false.</returns> public bool Contains(object value) { _logger.Log("Contains : " + value + " ", LogCategory.Info); T bo = (T)value; return(ViewOfBusinessObjectCollection.Contains(bo)); }
/// <summary> /// Removes the first occurrence of a specific object from the <see cref="IBusinessObjectCollection"/>. /// </summary> /// <param name="value">The object to remove from the <see cref="IBusinessObjectCollection"/>.</param> public void Remove(object value) { _logger.Log("Remove : " + value + " ", LogCategory.Info); var index = IndexOf(value); ViewOfBusinessObjectCollection.Remove((T)value); OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index, index)); }
/// <summary> /// Inserts an object to the <see cref="IBusinessObjectCollection"/> at the specified index. /// </summary> /// <param name="index">The zero-based index at which value should be inserted.</param> /// <param name="value">The object to insert into the collection.</param> public void Insert(int index, object value) { if (value != null && !typeof(T).IsAssignableFrom(value.GetType())) { throw new HabaneroArgumentException("Given instance doesn't match needed type."); } ViewOfBusinessObjectCollection.Insert(index, (T)value); BusinessObjectCollection.Insert(index, (T)value); FireListChanged(ListChangedType.ItemAdded, index); }
/// <summary> /// Inserts an object to the <see cref="IBusinessObjectCollection"/> at the specified index. /// </summary> /// <param name="index">The zero-based index at which value should be inserted.</param> /// <param name="value">The object to insert into the collection.</param> public void Insert(int index, object value) { if (value != null && !typeof(T).IsAssignableFrom(value.GetType())) { throw new HabaneroArgumentException("Given instance doesn't match needed type."); } _logger.Log("Insert Index : " + index + " value : " + value, LogCategory.Info); ViewOfBusinessObjectCollection.Insert(index, (T)value); BusinessObjectCollection.Insert(index, (T)value); OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index)); }
/// <summary> /// Returns the index of the row that has the given <see cref="T:System.ComponentModel.PropertyDescriptor"/>. /// </summary> /// <returns> /// The index of the row that has the given <see cref="T:System.ComponentModel.PropertyDescriptor"/>. /// </returns> /// <param name="property">The <see cref="T:System.ComponentModel.PropertyDescriptor"/> to search on. </param> /// <param name="key">The value of the <paramref name="property"/> parameter to search for.</param> public int Find(PropertyDescriptor property, object key) { if (property == null) { throw new ArgumentNullException("property"); } if (key == null) { throw new ArgumentNullException("key"); } var foundBO = ViewOfBusinessObjectCollection.Find(obj => obj.GetPropertyValue(property.Name) == key); if (foundBO == null) { return(-1); } return(ViewOfBusinessObjectCollection.IndexOf(foundBO)); }
/// <summary> /// Copies the objects of the <see cref="IBusinessObjectCollection"/> to an <see cref="Array"/>, /// starting at a particular <see cref="Array"/> index. /// </summary> /// <param name="array"> /// The one-dimensional <see cref="Array"/> that is the destination of the objects copied from /// <see cref="IBusinessObjectCollection"/>. The <see cref="Array"/> must have zero-based indexing. /// </param> /// <param name="index">The zero-based index in array at which copying begins.</param> public void CopyTo(Array array, int index) { if (array == null) { throw new ArgumentNullException("array"); } if (index < 0) { throw new ArgumentOutOfRangeException("index"); } if (index >= array.Length) { throw new ArgumentException("index"); } if (ViewOfBusinessObjectCollection != null) { ViewOfBusinessObjectCollection.CopyTo(array, index); } }
/// <summary> /// Returns the index of the row that has the given <see cref="T:System.ComponentModel.PropertyDescriptor"/>. /// </summary> /// <returns> /// The index of the row that has the given <see cref="T:System.ComponentModel.PropertyDescriptor"/>. /// </returns> /// <param name="property">The <see cref="T:System.ComponentModel.PropertyDescriptor"/> to search on. </param> /// <param name="key">The value of the <paramref name="property"/> parameter to search for.</param> public int Find(PropertyDescriptor property, object key) { if (property == null) { throw new ArgumentNullException("property"); } if (key == null) { throw new ArgumentNullException("key"); } _logger.Log("Find : " + property.Name + " value : " + key, LogCategory.Info); var foundBO = ViewOfBusinessObjectCollection.Find(obj => obj.GetPropertyValue(property.Name) == key); if (foundBO == null) { return(-1); } return(ViewOfBusinessObjectCollection.IndexOf(foundBO)); }
/// <summary> /// /// </summary> /// <param name="descriptionCollection"></param> public void ApplySort(ListSortDescriptionCollection descriptionCollection) { SortDescriptions = descriptionCollection; ViewOfBusinessObjectCollection.Sort(new GenericComparer <T>(SortDescriptions)); FireListChanged(ListChangedType.Reset); }
/// <summary> /// Determines the index of a specific item in the <see cref="IBusinessObjectCollection"/>. /// </summary> /// <param name="value">The object to locate in the collection.</param> /// <returns>The index of value if found in the list; otherwise, -1.</returns> public int IndexOf(object value) { return(ViewOfBusinessObjectCollection.IndexOf((T)value)); }
/// <summary> /// Determines whether the <see cref="IBusinessObjectCollection"/> contains a specific <see cref="BusinessObject"/>. /// </summary> /// <param name="value">The object to locate in the collection.</param> /// <returns>True if the object is found in the collection; otherwise, false.</returns> public bool Contains(object value) { T bo = (T)value; return(ViewOfBusinessObjectCollection.Contains(bo)); }
/// <summary> /// Removes the <see cref="IBusinessObjectCollection"/> item at the specified index. /// </summary> /// <param name="index">The zero-based index of the item to remove.</param> public void RemoveAt(int index) { _logger.Log("RemoveAt : " + index + " ", LogCategory.Info); ViewOfBusinessObjectCollection.RemoveAt(index); OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index)); }
/// <summary> /// Determines the index of a specific item in the <see cref="IBusinessObjectCollection"/>. /// </summary> /// <param name="value">The object to locate in the collection.</param> /// <returns>The index of value if found in the list; otherwise, -1.</returns> public int IndexOf(object value) { _logger.Log("IndexOf : " + value + " ", LogCategory.Info); return(ViewOfBusinessObjectCollection.IndexOf((T)value)); }
/// <summary> /// Removes all items from the <see cref="IList"/>. /// </summary> public void Clear() { _logger.Log("Clear ", LogCategory.Info); ViewOfBusinessObjectCollection.Clear(); OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, 0)); }