using System.Collections.Generic; namespace MLV; public class ManagedListViewItemsCollection : List { private ManagedListView owner; public ManagedListViewItemsCollection() { owner = null; } public ManagedListViewItemsCollection(IEnumerable newItems) : base(newItems) { owner = null; } public ManagedListViewItemsCollection(ManagedListView owner) { this.owner = owner; } public ManagedListViewItemsCollection(ManagedListView owner, IEnumerable newItems) : base(newItems) { this.owner = owner; } public new void Add(ManagedListViewItem item) { base.Add(item); if (owner != null) { owner.OnItemAdded(); } } public void AddNoEvent(ManagedListViewItem item) { base.Add(item); } public new void Clear() { base.Clear(); if (owner != null) { owner.OnItemsCollectionCleared(); } } public new bool Remove(ManagedListViewItem item) { bool result = base.Remove(item); if (owner != null) { owner.OnItemRemoved(); } return result; } public new void RemoveAt(int index) { base.RemoveAt(index); if (owner != null) { owner.OnItemRemoved(); } } public new void Insert(int index, ManagedListViewItem item) { base.Insert(index, item); if (owner != null) { owner.OnItemAdded(); } } public void InsertNoEvent(int index, ManagedListViewItem item) { base.Insert(index, item); } public new void Sort() { base.Sort(); if (owner != null) { owner.OnItemsCollectionSorted(); } } public new void Sort(IComparer comparer) { base.Sort(comparer); if (owner != null) { owner.OnItemsCollectionSorted(); } } public new void Sort(int index, int count, IComparer comparer) { base.Sort(index, count, comparer); if (owner != null) { owner.OnItemsCollectionSorted(); } } }