Esempio n. 1
0
        private void chattingPanel1_SeemoreLabelClicked(object sender, EventArgs e)
        {
            //this.linkLabel2.Cursor = Cursors.WaitCursor;
            try
            {
                KjqbService.ChatInService[] chat;

                chat = ser.SearchChatHistory((int)sendUser.Id, (int)receiveUser.Id, serviceTime);
                for (int i = 0; i < chat.Length; i++)
                {
                    if (chat[i].ReceiveUserId == sendUser.Id)
                    {
                        ChatintSubItem subitem = new ChatintSubItem();
                        subitem.HeaderId     = int.Parse(receiveUser.Id.ToString());
                        subitem.Message      = chat[i].ChatContent;
                        subitem.IsSayIngIsMe = false;

                        ChattingTimePanel time = new ChattingTimePanel();
                        time.TimeString = chat[i].TimeStamp.ToString("yyyy-MM-dd HH:mm");

                        this.chattingPanel1.AddChattingSubItemInDistoryPanel(subitem);

                        this.chattingPanel1.AddChattingTimePanelInDistoryPanel(time);
                        //createChatPanelOfflowlayout2(chat[i].ChatContent, receiveUser.KuName, chat[i].TimeStamp);
                    }
                    else if (chat[i].ReceiveUserId == receiveUser.Id)
                    {
                        ChatintSubItem subitem = new ChatintSubItem();
                        subitem.HeaderId     = int.Parse(sendUser.Id.ToString());
                        subitem.Message      = chat[i].ChatContent;
                        subitem.IsSayIngIsMe = true;

                        ChattingTimePanel time = new ChattingTimePanel();
                        time.TimeString = chat[i].TimeStamp.ToString("yyyy-MM-dd HH:mm");

                        this.chattingPanel1.AddChattingSubItemInDistoryPanel(subitem);

                        this.chattingPanel1.AddChattingTimePanelInDistoryPanel(time);

                        //createChatPanelOfflowlayout2(chat[i].ChatContent, sendUser.KuName, chat[i].TimeStamp);
                    }
                }

                serviceTime = chat[chat.Length - 1].TimeStamp;

                if (chat.Length > 0)
                {
                    //Point newPoint = new Point(0, 0);
                    //flowLayoutPanel1.AutoScrollPosition = newPoint;
                }
                else
                {
                    this.chattingPanel1.SetSeeMoreLabelText("没有了…");
                }
            }
            catch { }

            //this.linkLabel2.Cursor = Cursors.Hand;
        }
Esempio n. 2
0
        private void createChatPanel(string chatContent, long userId, DateTime dt)
        {
            ChattingTimePanel time = new ChattingTimePanel();

            time.TimeString = dt.ToString("yyyy-MM-dd HH:mm");
            this.chattingPanel1.AddChattingTimePanel(time);

            ChatintSubItem chatsubitem = new ChatintSubItem();

            chatsubitem.Message  = chatContent;
            chatsubitem.HeaderId = int.Parse(userId.ToString());
            if (userId == sendUser.Id)
            {
                chatsubitem.IsSayIngIsMe = true;
            }
            else
            {
                chatsubitem.IsSayIngIsMe = false;
            }
            this.chattingPanel1.AddChattingSubItem(chatsubitem);
        }