Example #1
0
        protected virtual bool beforeRemoveAt(int index)
        {
            bool cancel = false;
            BeforeRemoveAtEventHandler evt = BeforeRemoveAt;
            BeforeActionEventHandler   ae  = BeforeAction;

            if (evt != null)
            {
                evt(this, ref index, ref cancel);
            }
            if (ae != null)
            {
                ae(this, new ActionEventArgs(ListAction.RemoveAt, index), ref cancel);
            }
            return(cancel);
        }
Example #2
0
        protected virtual bool beforeRemoveRange(ref int start, ref int count)
        {
            bool cancel = false;
            BeforeRemoveRangeEventHandler evt = BeforeRemoveRange;
            BeforeActionEventHandler      ae  = BeforeAction;

            if (evt != null)
            {
                evt(this, ref start, ref count, ref cancel);
            }
            if (ae != null)
            {
                ae(this, new ActionEventArgs(ListAction.RemoveRange), ref cancel);
            }
            return(cancel);
        }
Example #3
0
        protected virtual bool beforeAddRange(IEnumerable <T> coll)
        {
            bool cancel = false;
            BeforeAddRangeEventHandler evt = BeforeAddRange;
            BeforeActionEventHandler   ae  = BeforeAction;

            if (evt != null)
            {
                evt(this, coll, ref cancel);
            }
            if (ae != null)
            {
                ae(this, new ActionEventArgs(ListAction.AddRange, coll), ref cancel);
            }
            return(cancel);
        }
Example #4
0
        /// <summary>Returns TRUE if Insert action should be cancelled.</summary>
        protected virtual bool beforeClear()
        {
            bool cancel = false;
            BeforeActionEventHandler ae  = BeforeAction;
            BeforeClearEventHandler  evt = BeforeClear;

            if (evt != null)
            {
                evt(this, ref cancel);
            }
            if (ae != null)
            {
                ae(this, new ActionEventArgs(ListAction.Clear), ref cancel);
            }
            return(cancel);
        }
Example #5
0
        /// <summary>Returns TRUE if Insert action should be cancelled.</summary>
        protected virtual bool beforeInsert(ref T item)
        {
            bool cancel = false;
            EventyListBeforeEventHandler evt = BeforeInsert;
            BeforeActionEventHandler     ae  = BeforeAction;

            if (evt != null)
            {
                evt(this, ref item, ref cancel);
            }
            if (ae != null)
            {
                ae(this, new ActionEventArgs(ListAction.Insert, item), ref cancel);
            }
            return(cancel);
        }
Example #6
0
        /// <summary>Returns TRUE if Set action should be cancelled.</summary>
        protected virtual bool beforeSet(ref T oldValue, ref T newValue)
        {
            bool cancel = false;
            BeforeSetEventHandler    evt = BeforeSet;
            BeforeActionEventHandler ae  = BeforeAction;

            if (evt != null)
            {
                evt(this, ref oldValue, ref newValue, ref cancel);
            }
            if (ae != null)
            {
                ae(this, new ActionEventArgs(ListAction.Set, oldValue, newValue), ref cancel);
            }
            return(cancel);
        }