/// <summary> /// 1. 노드 추가 /// 2. 창타이틀에 이름 반영 /// 3. 색깔반영 /// </summary> /// <param name="id"></param> /// <param name="name"></param> private void AddChatter(UserObject userObj) { TreeNode node = ChattersTree.Nodes.Add(userObj.Id, userObj.TitleName + "(" + userObj.Id + ")"); node.Tag = userObj; //node.ImageIndex = 0; //node.SelectedImageIndex = 0; node.BackColor = Color.FromArgb(205, 220, 237); if (ChattersTree.Nodes.Count == 1) this.Text += userObj.Name; else this.Text += "/" + userObj.Name; //채팅참여했다가 나간후 다시 참여한 경우, 원래 색을 그대로 쓴다. if (!htUserColorTable.Contains(userObj.Id)) { htUserColorTable.Add(userObj.Id, msgColor.GetColor(ChattersTree.Nodes.Count)); } //상태지정 SetChatterStatus(userObj.Id, userObj.Name, userObj.Status); }
/// <summary> /// 트리노드에 대화자 노드 추가 /// </summary> /// <param name="id">user id</param> /// <param name="name">user name</param> public void AddChatterToNode(UserObject userObj) { if (userObj == null || userObj.Id == null || userObj.Id.Trim() == "" || userObj.Id.Trim() == myId) return; TreeNode[] nodearray = ChattersTree.Nodes.Find(userObj.Id, false); if (nodearray != null && nodearray.Length != 0) { //있는경우는 오류 MsgrLogger.WriteLog(string.Format("AddChatterToNode:{0}({1})이 이미 존재함.", userObj.Name, userObj.Id)); } else { AddNextChatter(userObj); } }
public void AddNextChatter(UserObject userObj) { if (userObj == null || userObj.Id == null || userObj.Id.Trim() == "" || userObj.Id.Trim() == myId) return; AddChatter(userObj); PostUserJoinMessage(userObj.Name); }
public void SetChatterOnFormOpening(UserObject userObj) { if (userObj == null || userObj.Id == null || userObj.Id.Trim() == "" || userObj.Id.Trim() == myId) return; AddChatter(userObj); }
/// <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()); } }
public void OpenSingleChatForm(UserObject userObj) { if (userObj != null && InList.ContainsKey(userObj.Id) && InList[userObj.Id] != null) { ChatForm chatForm = ChatUtils.FindChatForm(ChatFormList, userObj.Id); //존재하는 대화창이 없는 경우 생성 if (chatForm == null) { MakeChatForm(userObj); } else { chatForm.SetForward(); } } else //대화가능한 상대방이 없을경우 { DialogResult result = MessageBox.Show(this, "대화할 상대방이 대화가 불가능한 상태입니다.\r\n 대신 쪽지를 보내시겠습니까?", "알림", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result == DialogResult.OK) { Hashtable MemoReceiver = new Hashtable(); MemoReceiver[userObj.Id] = userObj.Name; MakeSendMemo(MemoReceiver); } } }
/// <summary> /// Overloaded Class Constructor /// </summary> /// <param name="Object">Object</param> public ListBoxItem(UserObject userObj) { this.Text = string.Format("{0}({1})", userObj.Name, userObj.Id); this.Name = userObj.Id; this.Tag = userObj; this.Object = userObj; }