//更新一个对话item (新建或者更新)friendAndGroupID已包含friend或者group前缀
 public void reFreshContent(string friendAndGroupID, string content)
 {
     if (DialogueDic.ContainsKey(friendAndGroupID))//已有
     {
         DialogueDic[friendAndGroupID].reFreshContentSafePost(content);
     }
     else  //新建
     {
         IdAndContent idAndContent = new IdAndContent();
         idAndContent.friendAndGroupID = friendAndGroupID;
         idAndContent.content          = content;
         addItemSafePost(idAndContent);
     }
 }
        void addItem(object state)
        {
            IdAndContent idAndContent = (IdAndContent)state;
            DialogueItem item         = new DialogueItem(idAndContent.friendAndGroupID, idAndContent.content);

            DialogueDic.TryAdd(idAndContent.friendAndGroupID, item);
            this.flowLayoutPanel.Controls.Add(item);
            this.flowLayoutPanel.Controls.SetChildIndex(item, 0);
            //如果个数太多,销毁最后一个
            if (this.flowLayoutPanel.Controls.Count > 99)
            {
                //清除dic
                removeDialogueSafePost(((DialogueItem)this.flowLayoutPanel.Controls[this.flowLayoutPanel.Controls.Count - 1]).m_friendAndGroupID);
            }
        }
 //添加一个item。
 public void addItemSafePost(IdAndContent para)
 {
     m_SyncContext.Post(addItem, para);
 }