示例#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);
        }
示例#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);
        }
示例#3
0
文件: React.cs 项目: pbalaga/xreactor
 public static IObservableExpression <T> LazilyTo <T>(
     this ExpressionPreconfiguration preconfiguration,
     Expression <Func <T> > expressionToBeChanged)
 {
     throw new NotImplementedException();
 }
示例#4
0
文件: React.cs 项目: pbalaga/xreactor
 public static IObservableExpression <T> To <T>(
     this ExpressionPreconfiguration preconfiguration,
     Expression <Func <T> > expressionToBeChanged)
 {
     return(new ObservableExpression <T>(expressionToBeChanged, preconfiguration));
 }