示例#1
0
        protected void btnCompile_Click(object sender, EventArgs e)
        {
            lstCompilerOutput.Items.Clear();
            WebSharpCompilerBusiness.WebSharpCompiler compiler = new WebSharpCompilerBusiness.WebSharpCompiler();
            List <string> compilerErrors = compiler.Compile(txtCode.Text);

            if (compilerErrors.Count == 0)
            {
                lstCompilerOutput.Items.Add("No Errors");
            }

            foreach (string error in compilerErrors)
            {
                lstCompilerOutput.Items.Add(error);
            }
        }
    protected void btnCompile_Click(object sender, EventArgs e)
    {
        lstCompilerOutput.Items.Clear();
        WebSharpCompilerBusiness.WebSharpCompiler compiler = new WebSharpCompilerBusiness.WebSharpCompiler();
        List<string> compilerErrors = compiler.Compile(txtCode.Text);

        if (compilerErrors.Count == 0)
        {
            lstCompilerOutput.Items.Add("No Errors");
        }

        foreach (string error in compilerErrors)
        {
            lstCompilerOutput.Items.Add(error);
        }

    }
示例#3
0
        protected void answerButton_Click(object sender, EventArgs e)
        {
            int counter = Convert.ToInt32(this.TextBox1.Text);

            lstCompilerOutput.Items.Clear();
            WebSharpCompilerBusiness.WebSharpCompiler compiler = new WebSharpCompilerBusiness.WebSharpCompiler();

            List <string> compilerErrors = compiler.CompileError(txtCode.Text);


            if (compilerErrors.Count == 0)
            {
                lstCompilerOutput.Items.Add("No Errors");
                string result = compiler.CompileResult(txtCode.Text);
                ResultOutput.Text = result;
                NextLine(counter);
                if (answerLbl.Text == ResultOutput.Text)
                {
                    checkLbl.Visible   = true;
                    checkLbl.Text      = "Correct!";
                    checkLbl.ForeColor = System.Drawing.Color.Green;
                }
                else
                {
                    checkLbl.Visible   = true;
                    checkLbl.Text      = "False!";
                    checkLbl.ForeColor = System.Drawing.Color.Red;
                }
            }
            else
            {
                checkLbl.Visible   = true;
                checkLbl.Text      = "False!";
                checkLbl.ForeColor = System.Drawing.Color.Red;
                ResultOutput.Text  = "Error!, Check error output please !";
                foreach (string error in compilerErrors)
                {
                    lstCompilerOutput.Items.Add(error);
                }
            }
        }