Ejemplo n.º 1
0
 public BindingPropertyResolvers(IBindingExpressionBuilder bindingParser, StaticCommandBindingCompiler staticCommandBindingCompiler, JavascriptTranslator javascriptTranslator, DotvvmConfiguration configuration)
 {
     this.configuration = configuration;
     this.bindingParser = bindingParser;
     this.staticCommandBindingCompiler = staticCommandBindingCompiler;
     this.javascriptTranslator         = javascriptTranslator;
 }
Ejemplo n.º 2
0
 public static Expression ParseWithLambdaConversion(this IBindingExpressionBuilder builder, string expression, DataContextStack dataContexts, BindingParserOptions options, Type expectedType, params KeyValuePair <string, Expression>[] additionalSymbols)
 {
     if (expectedType.IsDelegate())
     {
         var resultType      = expectedType.GetMethod("Invoke").ReturnType;
         var delegateSymbols = expectedType
                               .GetMethod("Invoke")
                               .GetParameters()
                               .Select((p, index) => new KeyValuePair <string, Expression>(
                                           p.Name,
                                           Expression.Parameter(p.ParameterType, p.Name)
                                           .AddParameterAnnotation(new BindingParameterAnnotation(
                                                                       extensionParameter: new TypeConversion.MagicLambdaConversionExtensionParameter(index, p.Name, p.ParameterType)))
                                           ))
                               .ToArray();
         return(builder.Parse(expression, dataContexts, options, additionalSymbols.Concat(delegateSymbols).ToArray()));
     }
     else
     {
         return(builder.Parse(expression, dataContexts, options, additionalSymbols));
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultControlTreeResolver"/> class.
 /// </summary>
 public DefaultControlTreeResolver(DotvvmConfiguration configuration)
     : base(configuration.ServiceLocator.GetService <IControlResolver>(), configuration.ServiceLocator.GetService <IAbstractTreeBuilder>())
 {
     this.bindingExpressionBuilder = configuration.ServiceLocator.GetService <IBindingExpressionBuilder>();
 }
Ejemplo n.º 4
0
 public BindingPropertyResolvers(IBindingExpressionBuilder bindingParser, IViewModelSerializationMapper vmMapper, DotvvmConfiguration configuration)
 {
     this.configuration = configuration;
     this.bindingParser = bindingParser;
     this.vmMapper      = vmMapper;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultControlTreeResolver"/> class.
 /// </summary>
 public DefaultControlTreeResolver(IControlResolver controlResolver, IAbstractTreeBuilder treeBuilder, IBindingExpressionBuilder expressionBuilder)
     : base(controlResolver, treeBuilder)
 {
     this.bindingExpressionBuilder = expressionBuilder;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultControlTreeResolver"/> class.
 /// </summary>
 public DefaultControlTreeResolver(DotvvmConfiguration configuration)
     : base(configuration.ServiceLocator.GetService<IControlResolver>(), configuration.ServiceLocator.GetService<IAbstractTreeBuilder>())
 {
     this.bindingExpressionBuilder = configuration.ServiceLocator.GetService<IBindingExpressionBuilder>();
 }