async Task CollectionChanged(NotifyCollectionChangedEventArgs args) { switch (args.Action) { case NotifyCollectionChangedAction.Add: await Add(args); break; case NotifyCollectionChangedAction.Remove: await Remove(args); break; case NotifyCollectionChangedAction.Replace: await Replace(args); break; case NotifyCollectionChangedAction.Move: Move(args); break; case NotifyCollectionChangedAction.Reset: await Reload(); break; default: throw new ArgumentOutOfRangeException(); } CollectionItemsSourceChanged?.Invoke(this, args); }
void CollectionChanged(NotifyCollectionChangedEventArgs args) { switch (args.Action) { case NotifyCollectionChangedAction.Add: Add(args); break; case NotifyCollectionChangedAction.Remove: Remove(args); break; case NotifyCollectionChangedAction.Replace: Replace(args); break; case NotifyCollectionChangedAction.Move: Move(args); break; case NotifyCollectionChangedAction.Reset: notifier.NotifyDataSetChanged(); break; default: throw new ArgumentOutOfRangeException(nameof(args)); } CollectionItemsSourceChanged?.Invoke(this, args); }