/// <summary> /// Compile the script to check if the syntax is OK. /// </summary> /// <param name="dvtkScriptHost">The dvtk script host.</param> /// <param name="compileErrors">If existing, the compile errors.</param> private void Compile(DvtkScriptSupport.DvtkScriptHost dvtkScriptHost, out String compileErrors) { this.compileErrors = ""; // Add the compiler error event handler. DvtkScriptSupport.CompilerErrorEventHandler compilerErrorEventHandler = new DvtkScriptSupport.CompilerErrorEventHandler(OnCompilerError); dvtkScriptHost.CompilerErrorEvent += compilerErrorEventHandler; dvtkScriptHost.Compile(); // Remove the compiler error event handler. dvtkScriptHost.CompilerErrorEvent -= compilerErrorEventHandler; // When a compile error exists, this has been stored in this.compileErrors by the callback mathod. compileErrors = this.compileErrors; }