我正在将一个方法从WPF项目移植到WinForms项目中。
除了这一部分之外,其他都被顺利移动:
private void ServerProcErrorDataReceived(object sender, DataReceivedEventArgs e)
{
// You have to do this through the Dispatcher because this method is called by a different Thread
Dispatcher.Invoke(new Action(() =>
{
richTextBox_Console.Text += e.Data + Environment.NewLine;
richTextBox_Console.SelectionStart = richTextBox_Console.Text.Length;
richTextBox_Console.ScrollToCaret();
ParseServerInput(e.Data);
}));
}
我不知道如何将Dispatcher
转换为winforms。
有人能帮忙吗?