Example #1
0
 public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action, IList changedItems)
 {
     _newStartingIndex = -1;
     _oldStartingIndex = -1;
     if (((action != CollectionChangedNotifierAction.Add) && (action != CollectionChangedNotifierAction.Remove)) && (action != CollectionChangedNotifierAction.Reset))
     {
         throw new ArgumentException("Must be Reset, Add, or Remove Action for ctor", "action");
     }
     if (action == CollectionChangedNotifierAction.Reset)
     {
         if (changedItems != null)
         {
             throw new ArgumentException("Reset Action Requires Null Item", "action");
         }
         InitializeAdd(action, null, -1);
     }
     else
     {
         if (changedItems == null)
         {
             throw new ArgumentNullException("changedItems");
         }
         InitializeAddOrRemove(action, changedItems, -1);
     }
 }
Example #2
0
 public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action, object changedItem, int index)
 {
     _newStartingIndex = -1;
     _oldStartingIndex = -1;
     if (((action != CollectionChangedNotifierAction.Add) && (action != CollectionChangedNotifierAction.Remove)) && (action != CollectionChangedNotifierAction.Reset))
     {
         throw new ArgumentException("MustBeResetAddOrRemoveActionForCtor", "action");
     }
     if (action == CollectionChangedNotifierAction.Reset)
     {
         if (changedItem != null)
         {
             throw new ArgumentException("ResetActionRequiresNullItem", "action");
         }
         if (index != -1)
         {
             throw new ArgumentException("ResetActionRequiresIndexMinus1", "action");
         }
         InitializeAdd(action, null, -1);
     }
     else
     {
         InitializeAddOrRemove(action, new object[] { changedItem }, index);
     }
 }
Example #3
0
 public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action, IList changedItems, int startingIndex)
 {
     _newStartingIndex = -1;
     _oldStartingIndex = -1;
     if (((action != CollectionChangedNotifierAction.Add) && (action != CollectionChangedNotifierAction.Remove)) && (action != CollectionChangedNotifierAction.Reset))
     {
         throw new ArgumentException("MustBeResetAddOrRemoveActionForCtor", "action");
     }
     if (action == CollectionChangedNotifierAction.Reset)
     {
         if (changedItems != null)
         {
             throw new ArgumentException("ResetActionRequiresNullItem", "action");
         }
         if (startingIndex != -1)
         {
             throw new ArgumentException("ResetActionRequiresIndexMinus1", "action");
         }
         InitializeAdd(action, null, -1);
     }
     else
     {
         if (changedItems == null)
         {
             throw new ArgumentNullException("changedItems");
         }
         if (startingIndex < -1)
         {
             throw new ArgumentException("IndexCannotBeNegative", "startingIndex");
         }
         InitializeAddOrRemove(action, changedItems, startingIndex);
     }
 }
Example #4
0
 public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action, IList changedItems)
 {
     _newStartingIndex = -1;
     _oldStartingIndex = -1;
     if (((action != CollectionChangedNotifierAction.Add) && (action != CollectionChangedNotifierAction.Remove)) && (action != CollectionChangedNotifierAction.Reset))
     {
         throw new ArgumentException("Must be Reset, Add, or Remove Action for ctor", "action");
     }
     if (action == CollectionChangedNotifierAction.Reset)
     {
         if (changedItems != null)
         {
             throw new ArgumentException("Reset Action Requires Null Item", "action");
         }
         InitializeAdd(action, null, -1);
     }
     else
     {
         if (changedItems == null)
         {
             throw new ArgumentNullException("changedItems");
         }
         InitializeAddOrRemove(action, changedItems, -1);
     }
 }
Example #5
0
 public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action, object newItem, object oldItem, int index)
 {
     _newStartingIndex = -1;
     _oldStartingIndex = -1;
     if (action != CollectionChangedNotifierAction.Replace)
     {
         throw new ArgumentException("WrongActionForCtor", "action");
     }
     InitializeMoveOrReplace(action, new object[] { newItem }, new object[] { oldItem }, index, index);
 }
Example #6
0
        public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action)
        {
            _newStartingIndex = -1;
            _oldStartingIndex = -1;

            if (action != CollectionChangedNotifierAction.Reset)
            {
                throw new ArgumentException("WrongActionForCtor", "action");
            }

            InitializeAdd(action, null, -1);
        }
Example #7
0
        public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action)
        {
            _newStartingIndex = -1;
            _oldStartingIndex = -1;

            if (action != CollectionChangedNotifierAction.Reset)
            {
                throw new ArgumentException("WrongActionForCtor", "action");
            }

            InitializeAdd(action, null, -1);
        }
Example #8
0
 public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action, IList changedItems, int index, int oldIndex)
 {
     _newStartingIndex = -1;
     _oldStartingIndex = -1;
     if (action != CollectionChangedNotifierAction.Move)
     {
         throw new ArgumentException("WrongActionForCtor", "action");
     }
     if (index < 0)
     {
         throw new ArgumentException("IndexCannotBeNegative", "index");
     }
     InitializeMoveOrReplace(action, changedItems, changedItems, index, oldIndex);
 }
Example #9
0
 private void InitializeAddOrRemove(CollectionChangedNotifierAction action, IList changedItems, int startingIndex)
 {
     if (action == CollectionChangedNotifierAction.Add)
     {
         InitializeAdd(action, changedItems, startingIndex);
     }
     else if (action == CollectionChangedNotifierAction.Remove)
     {
         InitializeRemove(action, changedItems, startingIndex);
     }
     else
     {
         throw new ArgumentException("Unsupported action: {0}", action.ToString());
     }
 }
Example #10
0
 public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action, IList newItems, IList oldItems, int startingIndex)
 {
     _newStartingIndex = -1;
     _oldStartingIndex = -1;
     if (action != CollectionChangedNotifierAction.Replace)
     {
         throw new ArgumentException("WrongActionForCtor", "action");
     }
     if (newItems == null)
     {
         throw new ArgumentNullException("newItems");
     }
     if (oldItems == null)
     {
         throw new ArgumentNullException("oldItems");
     }
     InitializeMoveOrReplace(action, newItems, oldItems, startingIndex, startingIndex);
 }
Example #11
0
 public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action, IList changedItems, int startingIndex)
 {
     _newStartingIndex = -1;
     _oldStartingIndex = -1;
     if (((action != CollectionChangedNotifierAction.Add) && (action != CollectionChangedNotifierAction.Remove)) && (action != CollectionChangedNotifierAction.Reset))
     {
         throw new ArgumentException("MustBeResetAddOrRemoveActionForCtor", "action");
     }
     if (action == CollectionChangedNotifierAction.Reset)
     {
         if (changedItems != null)
         {
             throw new ArgumentException("ResetActionRequiresNullItem", "action");
         }
         if (startingIndex != -1)
         {
             throw new ArgumentException("ResetActionRequiresIndexMinus1", "action");
         }
         InitializeAdd(action, null, -1);
     }
     else
     {
         if (changedItems == null)
         {
             throw new ArgumentNullException("changedItems");
         }
         if (startingIndex < -1)
         {
             throw new ArgumentException("IndexCannotBeNegative", "startingIndex");
         }
         InitializeAddOrRemove(action, changedItems, startingIndex);
     }
 }
Example #12
0
 private void InitializeRemove(CollectionChangedNotifierAction action, IList oldItems, int oldStartingIndex)
 {
     _action = action;
     _oldItems = (oldItems == null) ? null : ArrayList.ReadOnly(oldItems);
     _oldStartingIndex = oldStartingIndex;
 }
Example #13
0
 private void InitializeMoveOrReplace(CollectionChangedNotifierAction action, IList newItems, IList oldItems, int startingIndex, int oldStartingIndex)
 {
     InitializeAdd(action, newItems, startingIndex);
     InitializeRemove(action, oldItems, oldStartingIndex);
 }
Example #14
0
 private void InitializeAddOrRemove(CollectionChangedNotifierAction action, IList changedItems, int startingIndex)
 {
     if (action == CollectionChangedNotifierAction.Add)
     {
         InitializeAdd(action, changedItems, startingIndex);
     }
     else if (action == CollectionChangedNotifierAction.Remove)
     {
         InitializeRemove(action, changedItems, startingIndex);
     }
     else
     {
         throw new ArgumentException("Unsupported action: {0}", action.ToString());
     }
 }
Example #15
0
 private void InitializeAdd(CollectionChangedNotifierAction action, IList newItems, int newStartingIndex)
 {
     _action = action;
     _newItems = (newItems == null) ? null : ArrayList.ReadOnly(newItems);
     _newStartingIndex = newStartingIndex;
 }
Example #16
0
 public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action, object newItem, object oldItem, int index)
 {
     _newStartingIndex = -1;
     _oldStartingIndex = -1;
     if (action != CollectionChangedNotifierAction.Replace)
     {
         throw new ArgumentException("WrongActionForCtor", "action");
     }
     InitializeMoveOrReplace(action, new object[] { newItem }, new object[] { oldItem }, index, index);
 }
Example #17
0
        public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action, object changedItem, int index, int oldIndex)
        {
            _newStartingIndex = -1;
            _oldStartingIndex = -1;
            if (action != CollectionChangedNotifierAction.Move)
            {
                throw new ArgumentException("WrongActionForCtor", "action");
            }
            if (index < 0)
            {
                throw new ArgumentException("IndexCannotBeNegative", "index");
            }
            object[] newItems = new object[] { changedItem };

            InitializeMoveOrReplace(action, newItems, newItems, index, oldIndex);
        }
Example #18
0
 public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action, IList newItems, IList oldItems, int startingIndex)
 {
     _newStartingIndex = -1;
     _oldStartingIndex = -1;
     if (action != CollectionChangedNotifierAction.Replace)
     {
         throw new ArgumentException("WrongActionForCtor", "action");
     }
     if (newItems == null)
     {
         throw new ArgumentNullException("newItems");
     }
     if (oldItems == null)
     {
         throw new ArgumentNullException("oldItems");
     }
     InitializeMoveOrReplace(action, newItems, oldItems, startingIndex, startingIndex);
 }
Example #19
0
 public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action, object changedItem, int index)
 {
     _newStartingIndex = -1;
     _oldStartingIndex = -1;
     if (((action != CollectionChangedNotifierAction.Add) && (action != CollectionChangedNotifierAction.Remove)) && (action != CollectionChangedNotifierAction.Reset))
     {
         throw new ArgumentException("MustBeResetAddOrRemoveActionForCtor", "action");
     }
     if (action == CollectionChangedNotifierAction.Reset)
     {
         if (changedItem != null)
         {
             throw new ArgumentException("ResetActionRequiresNullItem", "action");
         }
         if (index != -1)
         {
             throw new ArgumentException("ResetActionRequiresIndexMinus1", "action");
         }
         InitializeAdd(action, null, -1);
     }
     else
     {
         InitializeAddOrRemove(action, new object[] { changedItem }, index);
     }
 }
Example #20
0
 private void InitializeRemove(CollectionChangedNotifierAction action, IList oldItems, int oldStartingIndex)
 {
     _action           = action;
     _oldItems         = (oldItems == null) ? null : ArrayList.ReadOnly(oldItems);
     _oldStartingIndex = oldStartingIndex;
 }
Example #21
0
 private void InitializeMoveOrReplace(CollectionChangedNotifierAction action, IList newItems, IList oldItems, int startingIndex, int oldStartingIndex)
 {
     InitializeAdd(action, newItems, startingIndex);
     InitializeRemove(action, oldItems, oldStartingIndex);
 }
Example #22
0
 private void InitializeAdd(CollectionChangedNotifierAction action, IList newItems, int newStartingIndex)
 {
     _action           = action;
     _newItems         = (newItems == null) ? null : ArrayList.ReadOnly(newItems);
     _newStartingIndex = newStartingIndex;
 }