public NotificationCollectionChangedEventArgs(NotificationCollectionChangedAction action, object changedItem, int index) { this.newStartingIndex = -1; this.oldStartingIndex = -1; if (((action != NotificationCollectionChangedAction.Add) && (action != NotificationCollectionChangedAction.Remove)) && (action != NotificationCollectionChangedAction.Reset)) { throw new ArgumentException("Must Be Reset Add Or Remove Action For ConstruConstructor", "action"); } if (action == NotificationCollectionChangedAction.Reset) { if (changedItem != null) { throw new ArgumentException("Reset Action Requires Null Item", "action"); } if (index != -1) { throw new ArgumentException("Reset Action Requires (Index - 1)", "action"); } this.InitializeAdd(action, null, -1); } else { this.InitializeAddOrRemove(action, new object[] { changedItem }, index); } }
public NotificationCollectionChangedEventArgs(NotificationCollectionChangedAction action, IList changedItems, int startingIndex) { this.newStartingIndex = -1; this.oldStartingIndex = -1; if (((action != NotificationCollectionChangedAction.Add) && (action != NotificationCollectionChangedAction.Remove)) && (action != NotificationCollectionChangedAction.Reset)) { throw new ArgumentException("Must Be Reset Add Or Remove Action For ConstruConstructor", "action"); } if (action == NotificationCollectionChangedAction.Reset) { if (changedItems != null) { throw new ArgumentException("Reset Action Requires Null Item", "action"); } if (startingIndex != -1) { throw new ArgumentException("Reset Action Requires (Index - 1)", "action"); } this.InitializeAdd(action, null, -1); } else { if (changedItems == null) { throw new ArgumentNullException("changedItems"); } if (startingIndex < -1) { throw new ArgumentException("Index Cannot Be Negative", "startingIndex"); } this.InitializeAddOrRemove(action, changedItems, startingIndex); } }
public NotificationCollectionChangedEventArgs(NotificationCollectionChangedAction action, object newItem, object oldItem, int index) { this.newStartingIndex = -1; this.oldStartingIndex = -1; if (action != NotificationCollectionChangedAction.Replace) { throw new ArgumentException("Wrong Action For Constructor: " + NotificationCollectionChangedAction.Replace, "action"); } this.InitializeMoveOrReplace(action, new object[] { newItem }, new object[] { oldItem }, index, index); }
public NotificationCollectionChangedEventArgs(NotificationCollectionChangedAction action) { this.newStartingIndex = -1; this.oldStartingIndex = -1; if (action != NotificationCollectionChangedAction.Reset) { throw new ArgumentException("Wrong Action For ConstruConstructor: " + NotificationCollectionChangedAction.Reset, "action"); } this.InitializeAdd(action, null, -1); }
public NotificationCollectionChangedEventArgs(NotificationCollectionChangedAction action, IList changedItems, int index, int oldIndex) { this.newStartingIndex = -1; this.oldStartingIndex = -1; if (action != NotificationCollectionChangedAction.Move) { throw new ArgumentException("Wrong Action For Constructor: " + NotificationCollectionChangedAction.Move, "action"); } if (index < 0) { throw new ArgumentException("Index Cannot Be Negative", "index"); } this.InitializeMoveOrReplace(action, changedItems, changedItems, index, oldIndex); }
private void InitializeAddOrRemove(NotificationCollectionChangedAction action, IList changedItems, int startingIndex) { if (action == NotificationCollectionChangedAction.Add) { this.InitializeAdd(action, changedItems, startingIndex); } else if (action == NotificationCollectionChangedAction.Remove) { this.InitializeRemove(action, changedItems, startingIndex); } else { Debug.Assert(false, "Unsupported action: {0}", action.ToString()); } }
public NotificationCollectionChangedEventArgs(NotificationCollectionChangedAction action, IList newItems, IList oldItems, int startingIndex) { this.newStartingIndex = -1; this.oldStartingIndex = -1; if (action != NotificationCollectionChangedAction.Replace) { throw new ArgumentException("Wrong Action For Constructor: " + NotificationCollectionChangedAction.Replace, "action"); } if (newItems == null) { throw new ArgumentNullException("newItems"); } if (oldItems == null) { throw new ArgumentNullException("oldItems"); } this.InitializeMoveOrReplace(action, newItems, oldItems, startingIndex, startingIndex); }
public NotificationCollectionChangedEventArgs(NotificationCollectionChangedAction action, MenuNotification notification) { Action = action; Notification = notification; }
private void InitializeRemove(NotificationCollectionChangedAction action, IList oldItems, int oldStartingIndex) { this.action = action; this.oldItems = (oldItems == null) ? null : ArrayList.ReadOnly(oldItems); this.oldStartingIndex = oldStartingIndex; }
private void InitializeMoveOrReplace(NotificationCollectionChangedAction action, IList newItems, IList oldItems, int startingIndex, int oldStartingIndex) { this.InitializeAdd(action, newItems, startingIndex); this.InitializeRemove(action, oldItems, oldStartingIndex); }
private void InitializeAdd(NotificationCollectionChangedAction action, IList newItems, int newStartingIndex) { this.action = action; this.newItems = (newItems == null) ? null : ArrayList.ReadOnly(newItems); this.newStartingIndex = newStartingIndex; }
private void OnCollectionChanged(NotificationCollectionChangedAction action, object oldItem, object newItem, int index) { this.OnCollectionChanged(new NotificationCollectionChangedEventArgs(action, newItem, oldItem, index)); }