Exemplo n.º 1
0
        public bool ExcecuteCodeAndGenerateDocument(CodeEvaluationEventArgs args)
        {
            string theCode = String.Concat(CodeStart, args.Code, CodeEnd);

            string[] linesOfCode = new string[] { theCode };
            return(CompileAndRun(linesOfCode, args.EvaluationParameter));
        }
Exemplo n.º 2
0
        public void ForceCompile(CodeEvaluationEventArgs args)
        {
            compileComplete = false;
            if (!String.IsNullOrEmpty(args.Code))
            {
                CompileExampleAndShowPrintPreview(args);
            }

            compileComplete = true;
        }
Exemplo n.º 3
0
 protected internal virtual CodeEvaluationEventArgs RaiseQueryEvaluate()
 {
     if (QueryEvaluate != null)
     {
         CodeEvaluationEventArgs args = new CodeEvaluationEventArgs();
         QueryEvaluate(this, args);
         return(args);
     }
     return(null);
 }
Exemplo n.º 4
0
        void CompileExampleAndShowPrintPreview(CodeEvaluationEventArgs args)
        {
            bool evaluationSucceed = false;

            try {
                RaiseOnBeforeCompile();

                evaluationSucceed = Evaluate(args);
            }
            finally {
                RaiseOnAfterCompile(evaluationSucceed);
            }
        }
Exemplo n.º 5
0
        public void CompileExample(object sender, EventArgs e)
        {
            if (!compileComplete)
            {
                return;
            }
            CodeEvaluationEventArgs args = RaiseQueryEvaluate();

            if (!args.Result)
            {
                return;
            }

            ForceCompile(args);
        }
Exemplo n.º 6
0
        public bool Evaluate(CodeEvaluationEventArgs args)
        {
            ExampleCodeEvaluator spreadsheetExampleCodeEvaluator = GetExampleCodeEvaluator(args.Language);

            return(spreadsheetExampleCodeEvaluator.ExcecuteCodeAndGenerateDocument(args));
        }