/// <summary> /// 사용자가 대화하기를 선택시 대화창 생성 /// </summary> /// <param name="chatter"></param> /// <param name="ids"></param> private void MakeChatForm(UserObject userObj) { try { if (userObj.Id == null || userObj.Id == "") return; ChatForm chatForm = new ChatForm(myid); chatForm.SetCustomFont(custom_color, custom_font); chatForm.SetFormKey(ChatUtils.GetFormKey(userObj.Id, this.myid)); //DateTime.Now.ToString() +"!"+ this.myid; ChatFormList[chatForm.GetFormKey()] = chatForm; chatForm.SetChatterOnFormOpening(userObj);//대화창에 참가자 노드 추가(key=id, text=name) logWrite("Formkey 생성 : <" + chatForm.GetFormKey() + ">"); chatForm.ChatMessageAdded += ChatMessageAdded; chatForm.BtnAddChatter.MouseClick += new MouseEventHandler(BtnAddChatter_Click); chatForm.chatSendFile.MouseClick += new MouseEventHandler(chatSendFile_Click); chatForm.FormClosing += new FormClosingEventHandler(chatForm_FormClosing); chatForm.txtbox_exam.ForeColorChanged += new EventHandler(txtbox_exam_Changed); chatForm.txtbox_exam.FontChanged += new EventHandler(txtbox_exam_Changed); chatForm.Show(); chatForm.ReBox.Focus(); } catch (Exception exception) { logWrite(exception.ToString()); } }
/// <summary> /// 사용자가 다수의 상대방과 대화하기를 요청했을 경우 대화창 생성 /// </summary> /// <param name="chattersName">대화가능한 상대방의 이름열</param> /// <param name="nonchatters">대화불가능한 상대방의 이름열</param> /// <param name="ids">대화가능자의 id</param> private void MakeChatForm(List<UserObject> groupList, string chatIdList) { try { ChatForm chatForm = new ChatForm(myid); chatForm.SetCustomFont(custom_color, custom_font); chatForm.SetFormKey(ChatUtils.GetFormKey(chatIdList, this.myid));//DateTime.Now.ToString() + this.myid; logWrite("Formkey 생성 : " + chatForm.GetFormKey()); foreach (UserObject userObj in groupList) { if (userObj.Status != MsgrUserStatus.LOGOUT) { chatForm.SetChatterOnFormOpening(userObj); } else { chatForm.PostCanNotJoinMessage(userObj.Name); } } chatForm.ChatMessageAdded += ChatMessageAdded; chatForm.BtnAddChatter.MouseClick += new MouseEventHandler(BtnAddChatter_Click); chatForm.chatSendFile.MouseClick += new MouseEventHandler(chatSendFile_Click); chatForm.FormClosing += new FormClosingEventHandler(chatForm_FormClosing); chatForm.txtbox_exam.ForeColorChanged += new EventHandler(txtbox_exam_Changed); chatForm.txtbox_exam.FontChanged += new EventHandler(txtbox_exam_Changed); ChatFormList[chatForm.GetFormKey()] = chatForm; //ChatterList 저장(key=id/id/.. value=chatform) chatForm.Show(); chatForm.ReBox.Focus(); } catch (Exception exception) { logWrite(exception.ToString()); } }
/// <summary> /// 새로운 대화메시지 수신시 대화창 생성 /// </summary> /// <param name="ar">d|formkey|id/id/...|name|메시지내용</param> private void NewChatForm(string[] ar) //ar = d|formkey|id/id/...|name|메시지내용 { try { ChatForm chatForm = new ChatForm(myid); chatForm.SetCustomFont(custom_color, custom_font); chatForm.SetFormKey(ChatUtils.GetFormKey(ar[1], myid)); ChatFormList[chatForm.GetFormKey()] = chatForm; string[] tempidar = ar[2].Split('/'); //첫번째가 대화메시지 띄운 사람. foreach (string tempId in tempidar) { if (!this.myid.Equals(tempId)) { UserObject userObj = ChatUtils.FindUserObjectTagFromTreeNodes(memTree.Nodes, tempId); chatForm.SetChatterOnFormOpening(userObj); } } chatForm.ChatMessageAdded += ChatMessageAdded; chatForm.BtnAddChatter.MouseClick += new MouseEventHandler(BtnAddChatter_Click); chatForm.chatSendFile.MouseClick += new MouseEventHandler(chatSendFile_Click); chatForm.FormClosing += new FormClosingEventHandler(chatForm_FormClosing); chatForm.txtbox_exam.ForeColorChanged += new EventHandler(txtbox_exam_Changed); chatForm.txtbox_exam.FontChanged += new EventHandler(txtbox_exam_Changed); //chatForm.WindowState = FormWindowState.Minimized; //chatForm.Show(); chatForm.PostUserMessage(tempidar[0], ar[3]/*user name*/, ar[4]/*user msg*/); } catch (Exception exception) { logWrite(exception.ToString()); } }