protected PropertyNotifier Notify(NotifyCollectionChangedAction action, T item = default(T), int index = -1) { PropertyNotifier notifier = null; switch (action) { case NotifyCollectionChangedAction.Add: if (index == -1) { notifier = this.Notify(PropertyChanging, PropertyChanged, CollectionChanged, NotifyCollectionChangedAction.Add, item, "this[]", "Count"); } else { notifier = this.Notify(PropertyChanging, PropertyChanged, CollectionChanged, NotifyCollectionChangedAction.Add, item, index, "this[]", "Count"); } break; case NotifyCollectionChangedAction.Remove: notifier = this.Notify(PropertyChanging, PropertyChanged, CollectionChanged, NotifyCollectionChangedAction.Remove, item, index, "this[]", "Count"); break; case NotifyCollectionChangedAction.Replace: notifier = this.Notify(PropertyChanging, PropertyChanged, CollectionChanged, NotifyCollectionChangedAction.Replace, item, index, "this[]", "Count"); break; case NotifyCollectionChangedAction.Reset: notifier = this.Notify(PropertyChanging, PropertyChanged, CollectionChanged, NotifyCollectionChangedAction.Reset, "this[]", "Count"); break; default: Debugger.Break(); break; } return(notifier); }
protected void PostNotify(PropertyNotifier notifier, NotifyCollectionChangedAction action, T item, int index) { notifier.Dispose(); }