过程输出未实时显示&没完整

时间:2015-06-26 01:59:27

标签: c# visual-studio-2010

当我点击按钮时,过程输出未实时显示,并且在过程完成后仍然加载并且按钮不可点击

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();  
}

The full code is here

0 个答案:

没有答案