protected override void NotifySubscriptions(object sender, EventArgs e) { ObservableCollection <T> o = new ObservableCollection <T>(); var args = e as NotifyCollectionChangedEventArgs; CollectionUpdateMessage <U> m = new CollectionUpdateMessage <U>(); m.ObjectAdded = args.NewItems.Count > 0; if (m.ObjectAdded) { m.IndexChanged = args.NewStartingIndex; U[] newObjects = new U[args.NewItems.Count]; args.NewItems.CopyTo(newObjects, 0); m.newObjects = newObjects; } else { m.IndexChanged = args.OldStartingIndex; } string messageString = m.ToString(); foreach (Subscription s in Subscriptions) { s.SendMessage(messageString); } }
private void handleCollectionItemPropertyChanged(U sender, int index, string property) { CollectionUpdateMessage <U> m = new CollectionUpdateMessage <U>(); m.IndexChanged = index; m.newObjects = new U[1] { sender }; m.ObjectAdded = false; foreach (Subscription s in Subscriptions) { s.SendMessage(m.ToString()); } }