private void receptionEventHandler(object sender, receptionEventArgs e) { if (this.richTextBox1.InvokeRequired) { SetTextCallback1 b = new SetTextCallback1(receptionEventHandler); this.Invoke(b, this, e); } else { richTextBox1.AppendText(e.IDsender); richTextBox1.AppendText(" : "); richTextBox1.AppendText(e.Message); richTextBox1.AppendText("\n"); } }
private void SetText(string text) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.textBox_terminal.InvokeRequired) { SetTextCallback1 d = new SetTextCallback1(SetText); this.BeginInvoke(d, new object[] { text }); } else { this.textBox_terminal.Text += text; } }