예제 #1
0
            public void Add(ParametrizedCode code, byte operatorPrecedence = 20)
            {
                var needsParens = code.OperatorPrecedence.NeedsParens(operatorPrecedence);

                if (needsParens)
                {
                    Add("(");
                }
                code.CopyTo(this);
                if (needsParens)
                {
                    Add(")");
                }
            }
예제 #2
0
 public FakeCommandBinding(ParametrizedCode commandJavascript, BindingDelegate bindingDelegate)
 {
     this.commandJavascript = commandJavascript;
     this.bindingDelegate   = bindingDelegate;
 }
예제 #3
0
 public static string FormatKnockoutScript(this ParametrizedCode code, DotvvmBindableObject currentControl, IBinding currentBinding) =>
 JavascriptTranslator.FormatKnockoutScript(code, dataContextLevel: FindDataContextTarget(currentBinding, currentControl).stepsUp);
 public static string FormatKnockoutScript(ParametrizedCode code) => JavascriptTranslator.FormatKnockoutScript(code);
예제 #5
0
 public CommandJavascriptBindingProperty(ParametrizedCode code)
 {
     this.Code = code;
 }
예제 #6
0
 public SimplePathExpressionBindingProperty(ParametrizedCode code)
 {
     this.Code = code;
 }
예제 #7
0
 public KnockoutExpressionBindingProperty(ParametrizedCode code, ParametrizedCode unwrapedCode, ParametrizedCode wrappedCode)
 {
     this.Code         = code;
     this.UnwrapedCode = unwrapedCode;
     this.WrappedCode  = wrappedCode;
 }
예제 #8
0
 public StaticCommandJavascriptProperty(ParametrizedCode code)
 {
     this.Code = code;
 }
예제 #9
0
 /// Crates a new value binding expression from the specified .NET delegate and Javascript expression. Note that this operation is not very cheap and the result is not cached.
 public static ValueBindingExpression <T> CreateBinding <T>(BindingCompilationService service, Func <object[], T> func, ParametrizedCode expression, DataContextStack dataContext = null) =>
 new ValueBindingExpression <T>(service, new object[] {
     new BindingDelegate((o, c) => func(o)),
     new ResultTypeBindingProperty(typeof(T)),
     new KnockoutExpressionBindingProperty(expression, expression, expression),
     dataContext
 });
예제 #10
0
 public static JsSymbolicParameter CreateCodePlaceholder(ParametrizedCode code) =>
 new JsSymbolicParameter(
     new CodeSymbolicParameter("AdHoc placeholder"),
     new CodeParameterAssignment(code)
     );
예제 #11
0
 public static void SetViewModelClientPath(IDotvvmViewModel viewModel, ParametrizedCode path) =>
 viewModelPaths.Add(viewModel, path);
 public static ValueBindingExpression CreateBinding <T>(BindingCompilationService service, Func <object[], T> func, ParametrizedCode expression) =>
 new ValueBindingExpression(service, new object[] {
     new CompiledBindingExpression.BindingDelegate((o, c) => func(o)),
     new ResultTypeBindingProperty(typeof(T)),
     new KnockoutExpressionBindingProperty(expression, expression)
 });