Exemple #1
0
        public static IFluentContinuation <TViewModel, TPropertyValue> DifferentOf <TViewModel, TPropertyValue>(
            this IFluentOperator <TViewModel, TPropertyValue> instance, LateValue <TPropertyValue> lateValue)
            where TViewModel : ViewModelBase
        {
            var implementerInstance = (FluentImplementer <TViewModel, TPropertyValue>)instance;

            implementerInstance.EnsureContextCurrentPropertyIsNotNull();

            implementerInstance.AddToken(ExpressionNode.Not());
            implementerInstance.AddToken(ExpressionNode.EqualToLateValue(implementerInstance.Context.CurrentProperty, () => lateValue()));
            return((IFluentContinuation <TViewModel, TPropertyValue>)instance);
        }
Exemple #2
0
        public static IFluentContinuation <TViewModel, TPropertyValue> DifferentOf <TViewModel, TPropertyValue>(
            this IFluentOperator <TViewModel, TPropertyValue> instance, Expression <Func <TViewModel, IViewModelProperty> > propertyExpression)
            where TViewModel : ViewModelBase
        {
            var implementerInstance = (FluentImplementer <TViewModel, TPropertyValue>)instance;

            implementerInstance.EnsureContextCurrentPropertyIsNotNull();

            implementerInstance.UpdateContext(propertyExpression);

            // different of = not equal to property
            implementerInstance.AddToken(ExpressionNode.Not());
            implementerInstance.AddToken(ExpressionNode.EqualToProperty(implementerInstance.Context.CurrentProperty, propertyExpression.Compile()(implementerInstance.ViewModel)));
            return((IFluentContinuation <TViewModel, TPropertyValue>)instance);
        }
Exemple #3
0
        public static IFluentContinuation <TViewModel, TPropertyValue> Required <TViewModel, TPropertyValue>(
            this IFluentOperator <TViewModel, TPropertyValue> instance)
            where TViewModel : ViewModelBase
        {
            var implementerInstance = (FluentImplementer <TViewModel, TPropertyValue>)instance;

            implementerInstance.EnsureContextCurrentPropertyIsNotNull();

            // required = is neither null nor empty
            implementerInstance.AddToken(ExpressionNode.Not());
            implementerInstance.AddToken(ExpressionNode.OpenParenthesis());
            implementerInstance.AddToken(ExpressionNode.EqualToValue(implementerInstance.Context.CurrentProperty, null));
            implementerInstance.AddToken(ExpressionNode.Or());
            implementerInstance.AddToken(ExpressionNode.EqualToValue(implementerInstance.Context.CurrentProperty, string.Empty));
            implementerInstance.AddToken(ExpressionNode.CloseParenthesis());

            return((IFluentContinuation <TViewModel, TPropertyValue>)instance);
        }