Example #1
0
 /// <summary>
 /// Called when a compiler error exists in a Visual Basic Script, when Compile(...) is called.
 /// </summary>
 /// <param name="sender">The sended.</param>
 /// <param name="e">Arguments.</param>
 private void OnCompilerError(object sender, DvtkScriptSupport.CompilerErrorEventArgs e)
 {
     this.compileErrors = "\r\n";
     this.compileErrors+= "Compile error in \"" + scriptFullFileName + "\"\r\n";
     this.compileErrors+= String.Format("- Line number (in expanded Visual Basic Script): {0}\r\n", e.Line);
     this.compileErrors+= String.Format("- Line text: {0}", e.LineText);
     this.compileErrors+= String.Format("- Error description: {0}", e.Description);
 }
Example #2
0
        /// <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;
        }