Example #1
0
            public IDisposable Subscribe(IObserver <Func <T> > observer)
            {
                IDisposable subscription = this.owner.lazyPropertyChangeStream.Subscribe(observer);

                ObservableExpression.PushValueInUpToDateContext(() => observer.OnNext(this.owner.observedExpressionCompiled));
                return(subscription);
            }
Example #2
0
        public IDisposable Subscribe(IObserver <T> observer)
        {
            //First, subscribe the observer, so that property handlers are attached.
            //This is important in case of a cyclic reference. Without handlers in
            //place cyclic referencing would not occur, even though it should.

            //Then, publish a value immediately, so that an initial value can be set.
            //Notice the current value is only passed to the new observer.
            //Subscribers present until now are NOT given this value again.

            IDisposable subscription = this.propertyChangeStream.Subscribe(observer);

            ObservableExpression.PushValueInUpToDateContext(() => observer.OnNext(this.observedExpressionCompiled()));
            //try
            //{
            //observer.OnNext(this.observedExpressionCompiled());
            //}
            //catch (Exception ex)
            //{
            //}
            return(subscription);
        }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:LazyChannel"/> class.
 /// </summary>
 public LazyChannel(ObservableExpression <T> owner)
 {
     this.owner = owner;
 }