public void Add(ParametrizedCode code, byte operatorPrecedence = 20) { var needsParens = code.OperatorPrecedence.NeedsParens(operatorPrecedence); if (needsParens) { Add("("); } code.CopyTo(this); if (needsParens) { Add(")"); } }
public FakeCommandBinding(ParametrizedCode commandJavascript, BindingDelegate bindingDelegate) { this.commandJavascript = commandJavascript; this.bindingDelegate = bindingDelegate; }
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);
public CommandJavascriptBindingProperty(ParametrizedCode code) { this.Code = code; }
public SimplePathExpressionBindingProperty(ParametrizedCode code) { this.Code = code; }
public KnockoutExpressionBindingProperty(ParametrizedCode code, ParametrizedCode unwrapedCode, ParametrizedCode wrappedCode) { this.Code = code; this.UnwrapedCode = unwrapedCode; this.WrappedCode = wrappedCode; }
public StaticCommandJavascriptProperty(ParametrizedCode code) { this.Code = code; }
/// 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 });
public static JsSymbolicParameter CreateCodePlaceholder(ParametrizedCode code) => new JsSymbolicParameter( new CodeSymbolicParameter("AdHoc placeholder"), new CodeParameterAssignment(code) );
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) });