void AddText(string str, int chk) //0:둘다 1:send 2:receive { if (tbReceived.InvokeRequired) { cbAddText cb = new cbAddText(AddText); Invoke(cb, new object[] { str, chk }); } else { if (chk == 0) { tbReceived.AppendText(str + '\n'); tbSent.AppendText(str + '\n'); } else if (chk == 1) { tbReceived.AppendText("\n"); tbSent.AppendText(str + '\n'); } else { tbReceived.AppendText(str + '\n'); tbSent.AppendText("\n"); } //tbReceived.AppendText(str+'\n'); } }
void AddText(string str) { if (tbMonitor.InvokeRequired) { cbAddText cb = new cbAddText(AddText); Invoke(cb, new object[] { str }); } tbMonitor.AppendText(str); }
delegate void cbAddText(string str); //string str을 받아 tbServer에 출력하는 콜백함수 void AddText(string str) //tbServer에 str출력하는 함수, thread내부에서 호출될 함수 { if (tbServer.InvokeRequired) //cross thread로 인해 invoke필요한 경우 { cbAddText at = new cbAddText(AddText); //함수의 포인터 Invoke(at, new object[] { str }); } else { tbServer.Text += str; } }
void AddText(string str) { if (tbReceive.InvokeRequired) { cbAddText cb = new cbAddText(AddText); Invoke(cb, new object[] { str }); } else { tbReceive.AppendText(str); } }
void AddText(string str) { if (tbMain.InvokeRequired) { cbAddText cb = new cbAddText(AddText); Invoke(cb, new object[] { str }); } else { tbMain.AppendText(str + "\n"); } }
void AddText(string str) { if (tbClient.InvokeRequired) { cbAddText at = new cbAddText(AddText); object[] oArr = { str }; Invoke(at, oArr); } else { tbClient.Text += str; } }
delegate void cbAddText(string str); // string str을 인수로 받아서 tbServer에 출력하는 콜백 함수 // invoke void AddText(string str) // Thread 내부에서 호출될 함수 tbServer 출력 { if (tbServer.InvokeRequired) { cbAddText at = new cbAddText(AddText); object[] oArr = { str }; Invoke(at, oArr); } else { tbServer.Text += str; // Thread에서 수행해야 할 본래의 작업 } }
private void AddText(string str) { if (tbReceive.InvokeRequired) { cbAddText cb = new cbAddText(AddText); object[] oArr = { str }; Invoke(cb, oArr); } else { tbReceive.Text += str + "\r\n"; } }
void AddText(string str) { cbAddText cb = new cbAddText(AddText); Invoke(cb, new object[] { str }); }