/// <summary> /// Initializes a new instance of the <see cref="T:ObservableExpression"/> class. /// </summary> internal ObservableExpression(Expression <Func <T> > expressionToBeChanged, ExpressionPreconfiguration preconfiguration) { if (expressionToBeChanged == null) { throw new ArgumentNullException("expressionToBeChanged"); } this.observedExpression = expressionToBeChanged; this.observedExpressionCompiled = expressionToBeChanged.Compile(); this.properties = ExpressionHelper.GetUsedProperties(expressionToBeChanged, preconfiguration, true); this.changeStream = React.WhenAnyPropertyChanges(properties); this.propertyChangeStream = changeStream.Select(unit => this.observedExpressionCompiled()); this.lazyPropertyChangeStream = changeStream.Select(unit => this.observedExpressionCompiled); }
internal static UsedPropertyChain[] GetUsedProperties <T>( Expression <Func <T> > valueExpression, ExpressionPreconfiguration preconfiguration, bool attachHandlersImmediately ) { var set = new Set <UsedPropertyChain>(); TraversalOptions options = preconfiguration != null ? preconfiguration.Options : TraversalOptions.Default(); GetUsedProperties(set, valueExpression, ChildInformation.Null, options); UsedPropertyChain[] array = set.ToArray(); foreach (var up in array) { up.TopLevelParent = up; if (attachHandlersImmediately) { up.EnsureHandlersAreAttached(); } } return(array); }
public static IObservableExpression <T> LazilyTo <T>( this ExpressionPreconfiguration preconfiguration, Expression <Func <T> > expressionToBeChanged) { throw new NotImplementedException(); }
public static IObservableExpression <T> To <T>( this ExpressionPreconfiguration preconfiguration, Expression <Func <T> > expressionToBeChanged) { return(new ObservableExpression <T>(expressionToBeChanged, preconfiguration)); }