Пример #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);
     }
 }
Пример #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);
     }
 }
Пример #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);
     }
 }
Пример #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);
     }
 }
Пример #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);
 }
Пример #6
0
        public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action)
        {
            _newStartingIndex = -1;
            _oldStartingIndex = -1;

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

            InitializeAdd(action, null, -1);
        }
Пример #7
0
        public NotifyCollectionChangedEventArgs(CollectionChangedNotifierAction action)
        {
            _newStartingIndex = -1;
            _oldStartingIndex = -1;

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

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