当我点击按钮时,过程输出未实时显示,并且在过程完成后仍然加载并且按钮不可点击
private void button2_Click(object sender, EventArgs e)
{
this.button2.Enabled = false;
processCaller = new ProcessCaller(this);
processCaller.FileName = @"cmd.exe";
processCaller.Arguments = (@"/k chcp 1252 & %cd%\env\bin\ruby.exe %cd%\files\wpscan.rb --no-color --update");
processCaller.StdErrReceived += new DataReceivedHandler(writeStreamInfo);
processCaller.StdOutReceived += new DataReceivedHandler(writeStreamInfo);
processCaller.Completed += new EventHandler(processCompletedOrCanceled);
processCaller.Cancelled += new EventHandler(processCompletedOrCanceled);
//processCaller.Failed += no event handler for this one, yet;
this.textBox3.Text = "Started function. Please stand by.." + Environment.NewLine;
// the following function starts a process and returns immediately,
// thus allowing the form to stay responsive.
processCaller.Start();
}