private void AddChatMessageOnWritingCompleted() { string str = null; if (ReBox.Text.Trim().Length != 0) { if (this.ChattersTree.Nodes.Count == 0) {//채팅참가자 리스트뷰에 참가자가 없다면 MessageBox.Show("대화 상대방이 없습니다.\r\n대화할 상대방을 추가해 주세요.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); Logger.info("ChattersTree 에 대화상대방 없음"); } else {//채팅참가자가 있을 경우만 string ids = ConfigHelper.Id; foreach (TreeNode node in ChattersTree.Nodes) { ids += "/" + (node.Tag as MemberObj).Id; } //d|Formkey|id/id/..|발신자name|메시지 connection.SendMsgUserChatMsg(formKey, ids, ReBox.Text.Trim()); this.PostMyMessage(ConfigHelper.Name, ReBox.Text.Trim()); ReBox.Clear(); ReBox.Focus(); } } }
private void ReBox_KeyDown(object sender, KeyEventArgs e) { StopFlash(); if (e.Modifiers == Keys.ControlKey) { switch (e.KeyData) { case Keys.C: ReBox.Copy(); break; case Keys.P: ReBox.Paste(); break; case Keys.X: ReBox.Cut(); break; case Keys.A: ReBox.SelectAll(); break; } } }
private void AddMessage(string msg) { chatBox.AppendText(msg + "\r\n"); chatBox.ScrollToCaret(); if (isActivated) { ReBox.Focus(); } }
public void PostChatMessage(string userId, string userName, string message, bool isMine) { int startPos = 0; //이전 메시지올린사람과 동일인 경우, 생략. if (finalPoster != userName) { string msgUserName = userName + " 님의 말 :"; startPos = chatBox.Text.Length; AddMessage(msgUserName); chatBox.Select(startPos, msgUserName.Length); chatBox.SelectionFont = this.userNamePartFont; chatBox.SelectionColor = this.userNamePartColor; chatBox.ScrollToCaret(); } string msgMain = "ㆍ " + message; startPos = chatBox.Text.Length; AddMessage(msgMain); if (isMine) { chatBox.Select(startPos, msgMain.Length); chatBox.SelectionFont = this.messagePartFont; chatBox.SelectionColor = this.messagePartColor; } else { chatBox.Select(startPos, msgMain.Length); chatBox.SelectionColor = (Color)htUserColorTable[userId]; } chatBox.ScrollToCaret(); finalPoster = userName; if (!isMine) { StatusLabelChatStatus.Text = "마지막 메시지를 받은 시간:" + DateTime.Now.ToString(); } if (isActivated) { ReBox.Focus(); } }
/// <summary> /// 1:1창에서 out->in인 경우만 해당 /// 다자창에서 busy/dnd/away->in인 경우만 해당 /// </summary> /// <param name="userId"></param> /// <param name="userName"></param> public void SetChatterLogIn(string userId, string userName) { TreeNode[] node = ChattersTree.Nodes.Find(userId, false); if (node != null && node.Length != 0) { //메시지 표시 if (this.HasSingleChatter()) //다자창에서는 필요없음 { AddMessage(string.Format("{0}님이 로그인하셨습니다.\r\n", userName)); ReBox.Enabled = true; toolTip.RemoveAll(); ReBox.Focus(); } //노드에 로그인으로 표시함 SetChatterStatus(userId, userName, MsgrUserStatus.ONLINE); Logger.info(string.Format("{0}({1})를 로그인 처리.", userName, userId)); } }
private void SelectAllCtrlCToolStripMenuItem2_Click(object sender, EventArgs e) { ReBox.SelectAll(); }
private void PasteCtrlCToolStripMenuItem2_Click(object sender, EventArgs e) { ReBox.Paste(); }
private void CopyCtrlCToolStripMenuItem2_Click(object sender, EventArgs e) { ReBox.Copy(); }
private void ChatForm_Enter(object sender, EventArgs e) { ReBox.Focus(); }
private void ChatForm_Activated(object sender, EventArgs e) { ReBox.Focus(); isActivated = true; Logger.info("ChatForm_Activated"); }