private void 채팅창비우기ToolStripMenuItem_Click(object sender, EventArgs e) { Rtxtb_Chat_Log.Clear(); }
private bool Connect() { Pic_StatusIcon.Image = SimpleChatClient.Properties.Resources.yellow_button_clip_md; if (txtb_Server_IP.Text != "") { if (txtb_Server_Port.Text != "") { try { int TargetPort = Convert.ToInt16(this.txtb_Server_Port.Text); TargetServer = new TcpClient(this.txtb_Server_IP.Text, TargetPort); // // recvThread는 함수 RecvThread를 갖는 새로운 쓰레드로서 생성한뒤 실행한다. recvThread = new Thread(new ThreadStart(recvFunc)); recvThread.Start(); ConnStatusFindThread = new Thread(new ThreadStart(ConnStatusFind_Func)); ConnStatusFindThread.Start(); this.isRunning = true; this.btn_Connect.Enabled = false; this.btn_DisConnect.Enabled = true; this.btn_Send_Msg.Enabled = true; txtb_Server_IP.ReadOnly = true; txtb_Server_Port.ReadOnly = true; txtb_Chat_Box.Enabled = true; btn_Send_Msg.Enabled = true; txtb_Chat_Box.Focus(); Pic_StatusIcon.Image = SimpleChatClient.Properties.Resources.greenbutton_hi; txtb_Chat_Box.Clear(); Rtxtb_Chat_Log.Clear(); Rtxtb_Chat_Log.Invoke(new WriteChatLog(WriteLog), "서버와 연결되었습니다."); return(true); } catch { MessageBox.Show("서버에 연결할 수 없습니다.", "접속 오류", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtb_Server_IP.Focus(); Pic_StatusIcon.Image = SimpleChatClient.Properties.Resources.redbutton_hi; return(false); } } else { MessageBox.Show("포트 번호를 입력해주십시오.", "입력 오류", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtb_Server_Port.Focus(); Pic_StatusIcon.Image = SimpleChatClient.Properties.Resources.redbutton_hi; return(false); } } else { MessageBox.Show("서버의 IP주소를 입력해주십시오.", "입력 오류", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtb_Server_IP.Focus(); Pic_StatusIcon.Image = SimpleChatClient.Properties.Resources.redbutton_hi; return(false); } }