Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 public static IObservableExpression <T> LazilyTo <T>(
     this ExpressionPreconfiguration preconfiguration,
     Expression <Func <T> > expressionToBeChanged)
 {
     throw new NotImplementedException();
 }
Esempio n. 4
0
 public static IObservableExpression <T> To <T>(
     this ExpressionPreconfiguration preconfiguration,
     Expression <Func <T> > expressionToBeChanged)
 {
     return(new ObservableExpression <T>(expressionToBeChanged, preconfiguration));
 }