Exemple #1
0
 public void AddButton(string key, string msg)
 {
     if (this.InvokeRequired)
     {
         this.Invoke((MethodInvoker) delegate { AddButton(key, msg); });
     }
     else
     {
         int           cnt = BtnChatMemManager.getInstance().dicChatList.Count;
         ChatLstButton btn = new ChatLstButton(new Size(this.Width, 50), new Point(0, 50 * cnt), key, this);
         BtnChatMemManager.getInstance().dicChatList.Add(key, btn);
         btn.getMsg(msg);
     }
 }
Exemple #2
0
            void processData()
            {
                while (getdatalength() > 8) // 메세지를 2개이상 q받았을시도 처리
                {
                    TcpHeader head = this.getheader();
                    if (getdatalength() < head.msgsize)
                    {
                        break;
                    }

                    string strmsg = Encoding.Unicode.GetString(m_field, m_rear + 1 + m_headsize, (int)head.msgsize - m_headsize);
                    subData((int)head.msgsize);

                    int    indexof = strmsg.IndexOf(' ');
                    string Id      = strmsg.Substring(0, indexof);
                    string msg     = strmsg.Substring(indexof);

                    if (head.mode == 301)
                    {
                        msg.TrimEnd(' ');
                    }

                    ProfileForm profile = (ProfileForm)BtnChatMemManager.getInstance().dicFormList["profileForm"];
                    if (BtnChatMemManager.getInstance().dicProfileList.ContainsKey(Id))
                    {
                        if (BtnChatMemManager.getInstance().dicChatList.ContainsKey(Id))
                        {
                            ChatLstButton btn = ((ChatLstButton)BtnChatMemManager.getInstance().dicChatList[Id]);
                            if (btn.InvokeRequired)
                            {
                                btn.Invoke(btn.myDelegate, msg);
                            }
                            else
                            {
                                btn.getMsg(msg);
                            }
                        }
                        else
                        {
                            if (profile.InvokeRequired)
                            {
                                profile.Invoke((MethodInvoker) delegate { profile.AddButton(Id, msg); });
                            }
                        }
                    }
                    else
                    {
                        if (BtnChatMemManager.getInstance().dicChatList.ContainsKey(Id))
                        {
                            ChatLstButton btn = ((ChatLstButton)BtnChatMemManager.getInstance().dicChatList[Id]);
                            if (btn.InvokeRequired)
                            {
                                btn.Invoke(btn.myDelegate, msg);
                            }
                            else
                            {
                                btn.getMsg(msg);
                            }
                        }
                        else
                        {
                            if (profile.InvokeRequired)
                            {
                                profile.Invoke((MethodInvoker) delegate { profile.AddButton(Id, msg); });
                            }
                        }
                    }
                    profile.uncheckedMsg++;
                    profile.refreshGui();
                }
            }