Esempio n. 1
0
        public bool ExecuteCodeAndGenerateDocument(CodeEvaluationEventArgs args)
        {
            string theCode = String.Concat(CodeStart, args.Code, CodeBeforeClasses, args.CodeClasses, CodeEnd);

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

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

            try
            {
                RaiseOnBeforeCompile();

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

            if (!args.Result)
            {
                return;
            }

            ForceCompile(args);
        }
Esempio n. 6
0
        public bool Evaluate(CodeEvaluationEventArgs args)
        {
            ExampleCodeEvaluator snapExampleCodeEvaluator = GetExampleCodeEvaluator(args.Language);

            return(snapExampleCodeEvaluator.ExecuteCodeAndGenerateDocument(args));
        }