Beispiel #1
0
        private void ChatNav_SelectChatItem(object sender, ChatItem chatItem)
        {
            switch (chatItem.ChatType)
            {
            case ChatType.PrivateChat:
                this.labChatTitle.Text = "与【" + chatItem.DisplayName + "】的对话:";
                break;

            case ChatType.GroupChat:
                this.labChatTitle.Text = "全体成员聊天";
                break;

            case ChatType.TeamChat:
                this.labChatTitle.Text = "群组【" + chatItem.DisplayName + "】的聊天";
                break;

            default:
                break;
            }

            //  chatItem.Caption = chatItem.DisplayName;
            if (chatItem.FromClick && chatItem.UserName == selectUserName)
            {
                return;
            }
            //  chatItem.SmallImage = chatItem.DefaultImg;
            if (chatItem.UserName != selectUserName)
            {
                LoadChatMessage(chatItem);
            }
            AppendNewMessage(chatItem);
            selectUserName  = chatItem.UserName;
            _selectChatItem = chatItem;
        }
Beispiel #2
0
        //public static ChatItem CreateItem(this NavBarControl source,AddChatRequest request)
        //{
        //    ChatItem item = new ChatItem(source, request.UserName,
        //        request.DisplayName, request.ChatType, request.UserType);

        //    return item;
        //}

        public static ChatItem CreateItem(this NavBarControl source, ChatMessage request)
        {
            ChatItem item = new ChatItem(source, request.SendUserName,
                                         request.SendDisplayName, request.ChatType, request.UserType);

            return(item);
        }
Beispiel #3
0
        public static ChatItem CreateItem(this NavBarControl source, ChatStore store)
        {
            ChatItem item = new ChatItem(source, store.ChatUserName,
                                         store.ChatDisplayName, store.ChatType, store.UserType);

            return(item);
        }
Beispiel #4
0
        public ChatItem CreateItem(ChatMessage request)
        {
            ChatItem item = new ChatItem(this, request.SendUserName,
                                         request.SendDisplayName, request.ChatType, request.UserType);

            this.AddChatItem(item);
            return(item);
        }
Beispiel #5
0
        public ChatItem CreateGroupChatItem(ChatStore store)
        {
            ChatItem item = new ChatItem(this, store.ChatUserName,
                                         "全体成员", ChatType.GroupChat, ClientRole.Student);

            this.AddChatItem(item);
            return(item);
        }
Beispiel #6
0
        public ChatItem CreateTeamChatItem(Team team)
        {
            ChatItem item = new ChatItem(this, team.TeamId,
                                         team.TeamName, ChatType.TeamChat, ClientRole.Student);

            this.AddChatItem(item);
            return(item);
        }
Beispiel #7
0
 public void SetSelectChatItem(ChatItem item, bool fromClick)
 {
     ShowChatContent(item.ChatType);
     if (SelectedChatItem != null && SelectedChatItem.UserName != item.UserName)
     {
         SelectedChatItem.BackColor  = defaultBackColor;
         SelectedChatItem.IsSelected = false;
     }
     item.IsSelected            = true;
     SelectedChatItem           = item;
     SelectedChatItem.BackColor = defaultSelectChatItemColor;
     SelectedChatItem.FromClick = fromClick;
     SelectChatItem(this, SelectedChatItem);
 }
Beispiel #8
0
        /// <summary>
        /// 加载聊天历史记录
        /// </summary>
        private void LoadChatMessage(ChatItem subItem)
        {
            var chatStore = subItem.GetChatStore();

            if (chatStore == null)
            {
                return;
            }
            if (chatStore.HistoryContent == null)
            {
                chatStore.HistoryContent = new smsPanel();
                panelControl2.Controls.Add(chatStore.HistoryContent);
            }
            smsPanel1 = chatStore.HistoryContent;
            chatStore.HistoryContent.BringToFront();
        }
Beispiel #9
0
        /// <summary>
        /// 显示新的聊天信息
        /// </summary>
        /// <param name="subItem"></param>
        private void AppendNewMessage(ChatItem subItem)
        {
            var selectChatStore = subItem.GetChatStore();

            if (selectChatStore != null)
            {
                if (selectChatStore.NewMessageList != null)
                {
                    foreach (ChatMessage item in selectChatStore.NewMessageList)
                    {
                        AppendMessage(item, false);
                    }
                    GlobalVariable.SaveChatMessage(smsPanel1, subItem.UserName);
                }
            }
        }
Beispiel #10
0
        /// <summary>
        /// 加载聊天历史记录
        /// </summary>
        private void LoadChatMessage(ChatItem subItem)
        {
            var chatStore = subItem.GetChatStore();

            if (chatStore == null)
            {
                return;
            }
            if (chatStore.HistoryMessagePanel == null)
            {
                chatStore.HistoryMessagePanel = new smsPanel();
                panMessage.Controls.Add(chatStore.HistoryMessagePanel);
            }
            smsPanel1 = chatStore.HistoryMessagePanel;
            chatStore.HistoryMessagePanel.BringToFront();
        }
Beispiel #11
0
 /// <summary>
 /// 聊天列表对象被选中
 /// </summary>
 /// <param name="chatItem"></param>
 /// <param name="fromClick"></param>
 private void ChatItemSelected(ChatItem chatItem, bool fromClick)
 {
     this.labChatTitle.Text = "与【" + chatItem.DisplayName + "】的对话:";
     //  chatItem.Caption = chatItem.DisplayName;
     if (fromClick && chatItem.UserName == selectUserName)
     {
         return;
     }
     chatItem.SmallImage = chatItem.DefaultImg;
     if (chatItem.UserName != selectUserName)
     {
         LoadChatMessage(chatItem);
     }
     AppendNewMessage(chatItem);
     selectUserName       = chatItem.UserName;
     ChatNav.SelectedLink = chatItem.Links[0];
 }
Beispiel #12
0
 private void AddNewChatItem(ChatType type, string userName, string displayName)
 {
     for (int i = 0; i < 20; i++)
     {
         ChatItem item = new ChatItem(userName, displayName);
         if (type == ChatType.GroupChat || type == Common.ChatType.TeamChat)
         {
             Chanel1_Info.Show();
             this.Chanel1_Info.Controls.Add(item);
         }
         else
         {
             Chanel2_Info.Show();
             this.Chanel2_Info.Controls.Add(item);
         }
         item.Dock = DockStyle.Top;
         item.BringToFront();
         item.ChatItemSelect += Item_ChatItemSelect;
         item.SetSelect();
     }
 }
Beispiel #13
0
 /// <summary>
 /// 聊天列表对象被选中
 /// </summary>
 /// <param name="chatItem"></param>
 private void ChatItemSelected(ChatItem chatItem)
 {
     ChatNav.SetSelectChatItem(chatItem, false);
 }