Beispiel #1
0
 /// <summary>
 /// Fires <see cref="ItemsInserting" /> event.
 /// </summary>
 /// <param name="index">Index of item</param>
 /// <param name="value">Object containing event data.</param>
 protected virtual void OnItemsInserting(int index, GenericCancelEventArgs <BarItem> value)
 {
     if (ItemsInserting != null)
     {
         ItemsInserting(index, value);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Fires <see cref="ItemsClearing" /> event.
 /// </summary>
 /// <param name="value">Object containing event data.</param>
 protected virtual void OnItemsClearing(GenericCancelEventArgs <GenericCollection <BarItem> > value)
 {
     if (ItemsClearing != null)
     {
         ItemsClearing(value);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Performs additional custom processes when removing an element from the <see cref="T:System.Collections.CollectionBase"></see> instance.
        /// </summary>
        /// <param name="index">The zero-based index at which value can be found.</param>
        /// <param name="value">The value of the element to remove from index.</param>
        protected override void OnRemove(int index, object value)
        {
            var e = new GenericCancelEventArgs <T>((T)value);

            if (Removing != null)
            {
                Removing(index, e);
                if (e.Cancel)
                {
                    return;
                }
            }
            base.OnRemove(index, value);
        }
Beispiel #4
0
        /// <summary>
        /// Performs additional custom processes when clearing the contents of the <see cref="T:System.Collections.CollectionBase"></see> instance.
        /// </summary>
        protected override void OnClear()
        {
            var e = new GenericCancelEventArgs <GenericCollection <T> >(this);

            if (Clearing != null)
            {
                Clearing(e);
                if (e.Cancel)
                {
                    return;
                }
            }
            base.OnClear();
        }