/// <summary> /// Bind One Way (from the Source). /// </summary> /// <typeparam name = "T">Target <see cref = "ReactiveProperty{T}">ReactiveProperty</see> <see cref = "Type">Type</see></typeparam> /// <param name = "property">Target <see cref = "ReactiveProperty{T}">ReactiveProperty</see></param> /// <param name = "fromSource"><see cref = "IObservable{T}">IObservable</see> of updates from the source</param> public void Bind <T>(ReactiveProperty <T> property, IObservable <T> fromSource) { this.SetBinding(property, fromSource.Subscribe(this.GetSubject(property))); }
/// <summary> /// Bind Two Way (from and to the Source) /// </summary> /// <typeparam name = "T">Target <see cref = "ReactiveProperty{T}">ReactiveProperty</see> <see cref = "Type">Type</see></typeparam> /// <param name = "property">Target <see cref = "ReactiveProperty{T}">ReactiveProperty</see></param> /// <param name = "fromSource"><see cref = "IObservable{T}">IObservable</see> of updates from the source</param> /// <param name = "toSource"><see cref = "IObserver{T}">IObserver</see> of updates for the Source</param> public void Bind <T>(ReactiveProperty <T> property, IObservable <T> fromSource, IObserver <T> toSource) { ISubject <T> target = this.GetSubject(property); this.SetBinding(property, new CompositeDisposable(fromSource.Subscribe(target), target.Subscribe(toSource))); }
public IObserver <T> GetObserver <T, TOwner>(ReactiveProperty <T> property) where TOwner : class, IReactiveObject { return(this.GetSubject(property).AsObserver()); }
private static void StoreRegisteredProperty(string propertyName, Type ownerType, ReactiveProperty <T> property) { Dictionary <string, ReactiveProperty <T> > properties; if (!RegisteredProperties.TryGetValue(ownerType, out properties)) { properties = new Dictionary <string, ReactiveProperty <T> >(); RegisteredProperties[ownerType] = properties; } properties[propertyName] = property; }