Beispiel #1
0
        /// <inheritdoc />
        protected override void InsertItem(int index, T item)
        {
            var e = new CollectionChangingEventArgs(CollectionChangeAction.Add, index, item);

            OnCollectionChanging(e);

            if (e.Cancel)
            {
                return;
            }

            LogInsert(item);
            base.InsertItem(index, item);
        }
Beispiel #2
0
        /// <inheritdoc />
        protected override void RemoveItem(int index)
        {
            var e = new CollectionChangingEventArgs(CollectionChangeAction.Remove, index, Items[index]);

            OnCollectionChanging(e);

            if (e.Cancel)
            {
                return;
            }

            LogRemove(this[index]);
            base.RemoveItem(index);
        }
Beispiel #3
0
        /// <inheritdoc />
        protected override void ClearItems()
        {
            var e = new CollectionChangingEventArgs(CollectionChangeAction.Refresh);

            OnCollectionChanging(e);

            if (e.Cancel)
            {
                return;
            }

            foreach (var item in this)
            {
                LogRemove(item);
            }

            base.ClearItems();
        }
Beispiel #4
0
 /// <summary>
 /// Raises the <see cref="E:CollectionChanging"/> event.
 /// </summary>
 /// <param name="e">The <see cref="CollectionChangingEventArgs"/> instance containing the event data.</param>
 protected virtual void OnCollectionChanging(CollectionChangingEventArgs e)
 {
     CollectionChanging?.Invoke(this, e);
 }