Beispiel #1
0
 /// <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)));
 }
Beispiel #2
0
        /// <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)));
        }
Beispiel #3
0
 public IObserver <T> GetObserver <T, TOwner>(ReactiveProperty <T> property) where TOwner : class, IReactiveObject
 {
     return(this.GetSubject(property).AsObserver());
 }
Beispiel #4
0
        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;
        }