protected override IDisposable SubscribeCore(IObserver <EventPattern <PropertyChangedEventArgs> > observer) { var rootItem = new RootItem((INotifyPropertyChanged)this.sourceReference.Target); var path = new NotifyingPath(rootItem, this.propertyPath); var subscription = path.Last() .ObservePropertyChanged() .Subscribe(observer.OnNext, observer.OnError); return(new CompositeDisposable(2) { path, subscription }); }
internal NotifyingPath(RootItem root, IPropertyPath path) { this.root = root; var items = new INotifyingPathItem[path.Count + 1]; items[0] = root; INotifyingPathItem previous = root; for (int i = 0; i < path.Count; i++) { var item = new NotifyingPathItem(previous, path[i]); items[i + 1] = item; previous = item; } this.parts = items; }