示例#1
0
 public static string CompileToJavascript(Expression binding, DataContextStack dataContext)
 {
     var translator = new JavascriptTranslator();
     translator.DataContexts = dataContext;
     var script = translator.Translate(binding).Trim();
     if (binding.NodeType == ExpressionType.MemberAccess && script.EndsWith("()", StringComparison.Ordinal)) script = script.Remove(script.Length - 2);
     return script;
 }
示例#2
0
        public static JsExpression CompileToJavascript(Expression binding, DataContextStack dataContext, IViewModelSerializationMapper mapper)
        {
            var translator = new JavascriptTranslator(dataContext);
            var script     = translator.Translate(binding);

            //if (binding.NodeType == ExpressionType.MemberAccess && script.EndsWith("()", StringComparison.Ordinal)) script = script.Remove(script.Length - 2);
            script.AcceptVisitor(new JsViewModelPropertyAdjuster(mapper));
            return(script);
        }
示例#3
0
        public static string CompileToJavascript(Expression binding, DataContextStack dataContext)
        {
            var translator = new JavascriptTranslator();

            translator.DataContexts = dataContext;
            var script = translator.Translate(binding).Trim();

            if (binding.NodeType == ExpressionType.MemberAccess && script.EndsWith("()", StringComparison.Ordinal))
            {
                script = script.Remove(script.Length - 2);
            }
            return(script);
        }