Esempio n. 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);
     }
 }
Esempio n. 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);
     }
 }
Esempio n. 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);
     }
 }
Esempio n. 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);
     }
 }
Esempio n. 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);
 }
Esempio n. 6
0
        public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action)
        {
            _newStartingIndex = -1;
            _oldStartingIndex = -1;

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

            InitializeAdd(action, null, -1);
        }
Esempio n. 7
0
        public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action)
        {
            _newStartingIndex = -1;
            _oldStartingIndex = -1;

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

            InitializeAdd(action, null, -1);
        }
Esempio n. 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);
 }
Esempio n. 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());
     }
 }
Esempio n. 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);
 }
Esempio n. 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);
     }
 }
Esempio n. 12
0
 private void InitializeRemove(CollectionChangedNotifierAction action, IList oldItems, int oldStartingIndex)
 {
     _action = action;
     _oldItems = (oldItems == null) ? null : ArrayList.ReadOnly(oldItems);
     _oldStartingIndex = oldStartingIndex;
 }
Esempio n. 13
0
 private void InitializeMoveOrReplace(CollectionChangedNotifierAction action, IList newItems, IList oldItems, int startingIndex, int oldStartingIndex)
 {
     InitializeAdd(action, newItems, startingIndex);
     InitializeRemove(action, oldItems, oldStartingIndex);
 }
Esempio n. 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());
     }
 }
Esempio n. 15
0
 private void InitializeAdd(CollectionChangedNotifierAction action, IList newItems, int newStartingIndex)
 {
     _action = action;
     _newItems = (newItems == null) ? null : ArrayList.ReadOnly(newItems);
     _newStartingIndex = newStartingIndex;
 }
Esempio n. 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);
 }
Esempio n. 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);
        }
Esempio n. 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);
 }
Esempio n. 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);
     }
 }
Esempio n. 20
0
 private void InitializeRemove(CollectionChangedNotifierAction action, IList oldItems, int oldStartingIndex)
 {
     _action           = action;
     _oldItems         = (oldItems == null) ? null : ArrayList.ReadOnly(oldItems);
     _oldStartingIndex = oldStartingIndex;
 }
Esempio n. 21
0
 private void InitializeMoveOrReplace(CollectionChangedNotifierAction action, IList newItems, IList oldItems, int startingIndex, int oldStartingIndex)
 {
     InitializeAdd(action, newItems, startingIndex);
     InitializeRemove(action, oldItems, oldStartingIndex);
 }
Esempio n. 22
0
 private void InitializeAdd(CollectionChangedNotifierAction action, IList newItems, int newStartingIndex)
 {
     _action           = action;
     _newItems         = (newItems == null) ? null : ArrayList.ReadOnly(newItems);
     _newStartingIndex = newStartingIndex;
 }