예제 #1
0
        private void StateChangingInternal(Object sender, StateChangingEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            e.Cancel = !OnStateChanging(e.Item, e.StateType);
        }
예제 #2
0
 /// <summary>
 /// Raises StateChanging event of the item.
 /// </summary>
 /// <param name="stateType">Type of state that changes.</param>
 /// <returns>true if event handlers didn't cancel state changes; otherwise, false.</returns>
 protected virtual bool OnStateChanging(StateType stateType)
 {
     if (StateChanging != null)
     {
         StateChangingEventArgs args = new StateChangingEventArgs(this, stateType);
         StateChanging(this, args);
         return(!args.Cancel);
     }
     return(true);
 }
예제 #3
0
        /// <summary>
        /// Raises StateChanging event of the collection.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="stateType"></param>
        /// <returns></returns>
        private bool OnStateChanging(IListItem item, StateType stateType)
        {
            if (StateChanging == null)
            {
                return(true);
            }

            StateChangingEventArgs e = new StateChangingEventArgs(item, stateType);

            StateChanging(this, e);
            return(!e.Cancel);
        }