Beispiel #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));
        }
Beispiel #2
0
        public void ForceCompile(CodeEvaluationEventArgs args)
        {
            compileComplete = false;
            if (!String.IsNullOrEmpty(args.Code))
            {
                CompileExampleAndShowPrintPreview(args);
            }

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

            try
            {
                RaiseOnBeforeCompile();

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

            if (!args.Result)
            {
                return;
            }

            ForceCompile(args);
        }
Beispiel #6
0
        public bool Evaluate(CodeEvaluationEventArgs args)
        {
            ExampleCodeEvaluator richeditExampleCodeEvaluator = GetExampleCodeEvaluator(args.Language);

            return(richeditExampleCodeEvaluator.ExecuteCodeAndGenerateDocument(args));
        }