private void send() { chatBoxSend.Text = chatBoxSend.Text.TrimEnd('\n'); ChatBoxContent content = this.chatBoxSend.GetContent(); if (content.Text != "" && content.Text != "\n") { // //chatBoxSend.Text = chatBoxSend.Text.Remove(chatBoxSend.Text.Length - 1); //if(chatBoxSend.Text[chatBoxSend.Text.Length-1]=='\n') //{ // chatBoxSend.Text = chatBoxSend.Text.Remove(chatBoxSend.Text.Length - 2); //} //将内容更新到上方面板 this.AppendChatBoxContent(userItem.NicName, content); //发送信息 //取出收到的消息,.接收者ID卍发送者ID卍消息内容卍发送时间卍发送人名字 string split = Constant.SPLIT; string receiveId = item.ID.ToString(); string sendId = userItem.ID.ToString(); string msgText = content.Text; string date = DateTime.Now.ToString(); string sendName = userItem.NicName; string msg = receiveId + split + sendId + split + msgText + split + date + split + sendName; this.rapidPassiveEngine.CustomizeOutter.Send(receiveId, 1, System.Text.Encoding.UTF8.GetBytes(msg)); } //清空发送输入框 this.chatBoxSend.Text = string.Empty; this.chatBoxSend.Focus(); }
/// <summary> /// 发送信息文本到内容框 /// </summary> /// <param name="userName">名字</param> /// <param name="originTime">时间</param> /// <param name="content">发送内容</param> /// <param name="color">字体颜色</param> /// <param name="followingWords">是否有用户名</param> /// <param name="offlineMessage">是否在线消息</param> private void AppendChatBoxContent(string userName, DateTime?originTime, ChatBoxContent content, Color color, bool followingWords, bool offlineMessage) { if (!followingWords) { string showTime = DateTime.Now.ToLongTimeString(); if (!offlineMessage && originTime != null) { showTime = originTime.Value.ToString(); } this.chatBox_history.AppendRichText(string.Format("{0} {1}\n", userName, showTime), new Font(this.messageFont, FontStyle.Regular), color); if (originTime != null && offlineMessage) { this.chatBox_history.AppendText(string.Format(" [{0} 离线消息] ", originTime.Value.ToString())); } else { this.chatBox_history.AppendText(" "); } } else { this.chatBox_history.AppendText(" ."); } this.chatBox_history.AppendChatBoxContent(content); this.chatBox_history.AppendText("\n"); this.chatBox_history.Select(this.chatBox_history.Text.Length, 0); this.chatBox_history.ScrollToCaret(); }
private void button_send_Click(object sender, EventArgs e) { try { ChatBoxContent content = this.chatBox_send.GetContent(); if (content.IsEmpty()) { return; } byte[] buff = CompactPropertySerializer.Default.Serialize(content); this.AppendChatBoxContent(this.userID, content, Color.SeaGreen); //广播消息给组友 this.groupOutter.Broadcast(this.groupID, InformationTypes.BroadcastChat, buff, ActionTypeOnChannelIsBusy.Continue); //清空输入框 this.chatBox_send.Clear(); this.chatBox_send.Focus(); } catch (Exception ee) { Program.Logger.Log(ee, "TextChatControl.button_send_Click", ESBasic.Loggers.ErrorLevel.High); MessageBox.Show(ee.Message); } }
public LastWordsRecord(string _speakerID, string _speakerName, bool me, ChatBoxContent content) { this.speakerID = _speakerID; this.speakerName = _speakerName; this.isMe = me; this.chatBoxContent = content; }
/// <summary> /// 发送语音消息 /// </summary> /// <param name="userID"></param> /// <param name="fileName"></param> /// <param name="originTime"></param> /// <param name="FileName"></param> public void AppendVoiceContent(ChromiumWebBrowser browser, string userID, string fileName, DateTime originTime, string MineID, string FriendID, string fontName, string fontSize) { string showTime = DateTime.Now.ToLongTimeString(); #region 添加聊天历史记录 bool isSelf = true; string sendName = MineID; string sendTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (userID == FriendID) { isSelf = false; sendName = FriendID; } if (!string.IsNullOrEmpty(sendName) && sendName.Contains("@")) { sendName = sendName.Substring(0, sendName.IndexOf('@')); } string voicePath = TempFile.FileUploadWebSite + "voice/" + fileName; string id = fileName.Contains(".") ? fileName.Substring(0, fileName.LastIndexOf('.')) : fileName; this.addHistory_VoiceTalk(browser, isSelf, sendName, sendTime, id, voicePath, fontName, fontSize); #endregion if (isSelf && FormObj is ChatFormForWeb) { ChatFormForWeb frm = (ChatFormForWeb)FormObj; ChatBoxContent content = new ChatBoxContent(); content.Text = SysParams.Sys_VoiceMessage + fileName; frm.OPENFIRE_SendMessage(content, FriendID); } }
public HistoryForm(string user1, string user2, ChatFormForWeb mform) { InitializeComponent(); chatClass = new Chat(this); this.chatBoxSend = mform.ChatBoxSend; #region 添加浏览器 this.user1 = user1; this.user2 = user2; this.mform = mform; string chatWebPath = AppDomain.CurrentDomain.BaseDirectory + SysParams.Sys_MessageShownHtml; if (File.Exists(chatWebPath)) { browser = new ChromiumWebBrowser(chatWebPath) { Dock = DockStyle.Fill, }; browser.FrameLoadEnd += Browser_FrameLoadEnd; browser.Load(chatWebPath); //"jsOBJ" comm.RegObjectTOCEF(browser, comm, "jsOBJ"); pnlContent.Controls.Add(browser); //browser.DragDrop += Control_DragDrop; //browser.DragEnter += Control_DragEnter; //browser.AllowDrop = true; } #endregion }
public ChatForm(ChatListSubItem friend, string mineID, ChatBoxContent content) { InitializeComponent(); lblName.Text = friend.DisplayName; lblCompany.Text = friend.PersonalMsg; FriendIDAndStaue = ((GGUser)(friend.Tag)).JID.ToString(); Friend = friend; chatHeadState(friend); MineID = mineID; FrendID = friend.ID; //if (FrendID.Equals("yujunming192.168.1.95")) //{ // client = new XmppClient("chengle", "192.168.1.95", "111111"); //} //else //{ // client = new XmppClient("yujunming", "192.168.1.95", "111111"); //} //client.OnMessage += C_OnMessage; //client.Open(); //Console.WriteLine("{0}", client); }
void ChatHandleReceive(object sender, EventArgs e, Msg msg)//处理事件的程序 { if (Convert.ToUInt32(msg.FromUser) == item.ID) { ChatBoxContent content = new ChatBoxContent(); content.Text = msg.Content; this.AppendChatBoxContent(item.NicName, content); } }
public void ShowOtherTextChat(string broadcastID, ChatBoxContent content) { if (this.InvokeRequired) { this.Invoke(new CbGeneric <string, ChatBoxContent>(this.ShowOtherTextChat), broadcastID, content); } else { this.AppendChatBoxContent(broadcastID, content, Color.Black); } }
private void AppendChatBoxContent(string userName, ChatBoxContent content, Color color) { string showTime = DateTime.Now.ToLongTimeString(); this.chatBox_his.AppendRichText(string.Format("{0} {1}\n", userName, showTime), new Font(this.messageFont, FontStyle.Regular), color); this.chatBox_his.AppendText(" "); this.chatBox_his.AppendChatBoxContent(content); this.chatBox_his.AppendText("\n"); this.chatBox_his.Select(this.chatBox_his.Text.Length, 0); this.chatBox_his.ScrollToCaret(); }
public void AppendChatBoxContent(ChatBoxContent content) { try { if (content == null || content.Text == null) { return; } int count = this.Text.Length; if (content.ForeignImageDictionary != null) { string pureText = content.Text; //去掉表情和图片的占位符 List <uint> tempList = new List <uint>(); foreach (uint key in content.ForeignImageDictionary.Keys) { tempList.Add(key); } tempList.Sort(); for (int i = tempList.Count - 1; i >= 0; i--) { pureText = pureText.Remove((int)tempList[i], 1); } this.AppendText(pureText); //插入 for (int i = 0; i < tempList.Count; i++) { uint position = tempList[i]; this.InsertImage(content.ForeignImageDictionary[position], (int)(count + position)); } } else { this.AppendText(content.Text); } this.Select(count, content.Text.Length); if (content.Color != null) { this.SelectionColor = content.Color; } if (content.Font != null) { this.SelectionFont = content.Font; } } catch (Exception ee) { MessageBox.Show(ee.Message); } }
public void AddReceivedMsg(PrivateChatRequest response) { ChatBoxContent content = new ChatBoxContent(response.msg, messageFont, Color.Black); var showTime = DateTime.Now.ToLongTimeString(); this.chatBox_history.AppendRichText(string.Format("{0} {1}\n", response.sendname, showTime), new Font(this.messageFont, FontStyle.Regular), Color.Blue); content.Text = " " + content.Text.Replace("\n", "\n "); this.chatBox_history.AppendChatBoxContent(content); this.chatBox_history.AppendText("\n"); this.chatBox_history.Select(this.chatBox_history.Text.Length, 0); this.chatBox_history.ScrollToCaret(); }
private void AppendChatBoxContent(string NicName, ChatBoxContent content) { Color NicNameColor = Color.SeaGreen; Color textColor = Color.Black; string showTime = DateTime.Now.ToString(); this.chatBox_history.AppendRichText(string.Format("\n{0} {1}\n", NicName, showTime), new Font(this.messageFont, FontStyle.Regular), NicNameColor); this.chatBox_history.AppendRichText(string.Format("{0}", content.Text), content.Font, textColor); //chatBox_history//GoToLineAndColumn(chatBox_history, chatBox_history.Lines.Length, 0); chatBox_history.SelectionStart = chatBox_history.TextLength; chatBox_history.ScrollToCaret(); }
private void AppendChatBoxContent(string NicName,ChatBoxContent content) { Color NicNameColor = Color.SeaGreen; Color textColor = Color.Black; string showTime = DateTime.Now.ToString(); this.chatBox_history.AppendRichText(string.Format("\n{0} {1}\n", NicName, showTime), new Font(this.messageFont, FontStyle.Regular), NicNameColor); this.chatBox_history.AppendRichText(string.Format("{0}", content.Text), content.Font, textColor); //chatBox_history//GoToLineAndColumn(chatBox_history, chatBox_history.Lines.Length, 0); chatBox_history.SelectionStart = chatBox_history.TextLength; chatBox_history.ScrollToCaret(); }
private void btnSend_Click(object sender, EventArgs e) { ChatBoxContent content = this.chatBoxSend.GetContent(); //发送内容为空时,不做响应 if (content.IsEmpty()) { return; } SendMessage(content.Text); AddMessageToHistory(content); var message = new ChatMessage(_myUserName, _myDisplayName, _userName, content); GlobalVariable.SaveChatMessage(message); }
private void btnSend_Click(object sender, EventArgs e) { ChatBoxContent content = this.chatBoxSend.GetContent(); //发送内容为空时,不做响应 if (content.IsEmpty()) { return; } this.AppendChatBoxContent("乔克斯", null, content, Color.SeaGreen, false); //清空发送输入框 this.chatBoxSend.Text = string.Empty; this.chatBoxSend.Focus(); //请求小黄鸡回复 System.Threading.ThreadPool.QueueUserWorkItem((s) => GoChat(content.Text)); }
private void AddMessageToHistory(ChatBoxContent content) { var showTime = DateTime.Now.ToLongTimeString(); this.chatBox_history.AppendRichText(string.Format("{0} {1}\n", _myDisplayName, showTime), new Font(this.messageFont, FontStyle.Regular), Color.SeaGreen); content.Text = " " + content.Text.Replace("\n", "\n "); this.chatBox_history.AppendChatBoxContent(content); this.chatBox_history.AppendText("\n"); this.chatBox_history.Select(this.chatBox_history.Text.Length, 0); this.chatBox_history.ScrollToCaret(); //清空发送输入框 this.chatBoxSend.Text = string.Empty; this.chatBoxSend.Focus(); }
void GroupOutter_BroadcastReceived(string broadcasterID, string groupID, int broadcastType, byte[] broadcastContent) { try { if (groupID == this.groupID) { #region 即时通信消息的处理 if (broadcastType == InformationTypes.BroadcastChat) { ChatBoxContent contract = CompactPropertySerializer.Default.Deserialize <ChatBoxContent>(broadcastContent, 0); string msg = string.Format("{0}说: ", broadcasterID, DateTime.Now) + contract.Text; //当收到广播 消息,如果tablePage不在即时通讯 页,则在 标题上面显示 新增 消息数量 this.DealBeforeShowMessage(msg); if (contract != null) { this.textChatControl1.ShowOtherTextChat(broadcasterID, contract); } return; } #endregion #region 共享桌面消息的处理 if (broadcastType == InformationTypes.BroadcastShareDesk) { bool isShare = BitConverter.ToBoolean(broadcastContent, 0); if (isShare) { this.OpenRemotingDesktop(broadcasterID); } else { this.CloseRemotingDesktop(broadcasterID); } return; } #endregion } } catch (Exception ee) { Program.Logger.Log(ee, string.Format("mainform.GroupOutter_BroadcastReceived({0},{1},{2})", broadcasterID, groupID, broadcastType), ESBasic.Loggers.ErrorLevel.High); MessageBox.Show(ee.Message); } }
/// <summary> /// 获取Box中的所有内容。 /// </summary> /// <param name="containsForeignObject">内容中是否包含不是由IImagePathGetter管理的图片对象</param> /// <returns>key为位置,val为图片的ID</returns> public ChatBoxContent GetContent() { ChatBoxContent content = new ChatBoxContent(this.Text, this.Font, this.ForeColor); List <REOBJECT> list = this.RichEditOle.GetAllREOBJECT(); for (int i = 0; i < list.Count; i++) { uint pos = (uint)list[i].posistion; content.PicturePositions.Add(pos); if (list[i].dwUser != 10000) { content.AddEmotion(pos, list[i].dwUser); } else { GifBox box = (GifBox)Marshal.GetObjectForIUnknown(list[i].poleobj); content.AddForeignImage(pos, box.Image); } } return(content); }
public void add(string user1, string user2) { DataTable dt = Common.retTalkHistory(user1, user2); CefSharp.IFrame ifm = browser.GetBrowser().MainFrame; this.comm.CallJS(browser, " clearAll()"); // this.CallJS(browser, addFunctionStr); if (dt != null && dt.Rows.Count > 0) { string messageDate = string.Empty; for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; string fromid = dr["fromjid"].ToString(); string toid = dr["tojid"].ToString(); string contentStr = dr["body"].ToString(); Int64 tmpval = Convert.ToInt64(dr["SENTDATE"].ToString()); DateTime d = new DateTime(1970, 1, 1).ToLocalTime().AddMilliseconds(long.Parse(dr["SENTDATE"].ToString())); string dateTime = d.ToString("yyyy-MM-dd HH:mm:ss"); ChatBoxContent content = new ChatBoxContent(); content.Text = contentStr; string messType = SysParams.retSysMessage(contentStr); if (messageDate != d.ToString("yyyy-MM-dd")) { //添加间隔线和日期 messageDate = d.ToString("yyyy-MM-dd"); this.chatClass.AppendHistoryLine(this.browser, messageDate); } this.chatClass.AppendChatBoxContentAll(this.browser, messType, fromid, d, content, this.mform.MineID, this.mform.FriendID, Color.SeaGreen, true, true); //this.AppendChatBoxContentAll(messType, fromid, d, content, Color.SeaGreen, true, true); } } }
/// <summary> /// 发送信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ibtnSend_Click(object sender, EventArgs e) { try { ChatBoxContent content = this.chatBoxSend.GetContent(); if (xmppSendMessageBtnClick != null) { xmppSendMessageBtnClick(content, FrendID); //Matrix.Xmpp.Client.Message msg = new Matrix.Xmpp.Client.Message(FrendID, content.Text, "", ""); //this.client.Send(msg); } if (content.IsEmpty()) { return; } bool followingWords = false; this.AppendChatBoxContent(MineID, null, content, Color.SeaGreen, followingWords); //清空输入框 this.chatBoxSend.Text = string.Empty; this.chatBoxSend.Focus(); } catch (Exception ee) { this.AppendSysMessage("发送消息失败!" + ee.Message); } }
/// <summary> /// 系统消息处理 /// </summary> /// <param name="form"></param> /// <param name="message"></param> public static void SysMessageManage(ChatFormForWeb form, string userID, string message, ChatBoxContent chatcontent) { switch (message) { case SysParams.Sys_VibrationMessage: //震动消息处理 form.AppendChatBoxContent(true, userID, DateTime.Now, chatcontent, Color.Blue, false); Common.VibrationThread(form); break; } }
/// <summary> /// 消息处理展示 /// </summary> /// <param name="messType"></param> /// <param name="isSysMessage"></param> /// <param name="userID"></param> /// <param name="originTime"></param> /// <param name="content"></param> /// <param name="color"></param> /// <param name="followingWords"></param> public void AppendChatBoxContentAll(ChromiumWebBrowser browser, string messType, string userID, DateTime originTime, ChatBoxContent content, string MineID, string FriendID, System.Drawing.Color color, bool followingWords, bool isOnload = false) { if (browser.IsBrowserInitialized) { string fontName = content.Font == null?"宋体": content.Font.FontFamily.Name; string fontSize = content.Font == null ? "12":content.Font.Size.ToString(); switch (messType) { case SysParams.Sys_AddFriendMessage: //添加好友消息 //AddUserForm(string JID, string messageStr) break; case SysParams.Sys_Normal: //标注聊天消息 int subLength = SysParams.Sys_Normal.Length; if (!string.IsNullOrEmpty(content.Text)) { content.Text = content.Text.Substring(subLength); } this.AppendChatBoxContent(browser, userID, originTime, content.Text, content.ForeignImageDictionary, followingWords, MineID, FriendID , color, fontName, fontSize, originTime != null); break; case SysParams.Sys_VibrationMessage: //震动提示 this.AppendSysContent(browser, userID, originTime, content.Text, MineID, FriendID, color, followingWords, originTime != null); if (FormObj is ChatFormForWeb) { Common.Vibration(FormObj); } break; case SysParams.Sys_VoiceMessage: //语音 string fileName = content.Text.Replace(SysParams.Sys_VoiceMessage, ""); if (!string.IsNullOrEmpty(fileName)) { AppendVoiceContent(browser, userID, fileName, originTime, MineID, FriendID, fontName, fontSize); } break; case SysParams.Sys_SendFileMessage: //文件发送-处理发送方消息 string sendContent = string.Empty; if (!string.IsNullOrEmpty(content.Text)) { subLength = SysParams.Sys_SendFileMessage.Length; sendContent = content.Text.Substring(subLength); FileClass file = JsonConvert.DeserializeObject <FileClass>(sendContent); if (FormObj is ChatFormForWeb && file != null) { file.IsSender = false; //添加控件 ((ChatFormForWeb)FormObj).AddProcess_Receive(file, isOnload); } } break; case SysParams.Sys_ReceiveFileMessage: //文件发送-处理接收方 发送的同意请求消息 if (!string.IsNullOrEmpty(content.Text)) { sendContent = content.Text.Substring(SysParams.Sys_ReceiveFileMessage.Length); FileClass file = JsonConvert.DeserializeObject <FileClass>(sendContent); if (FormObj is ChatFormForWeb && file != null) { file.IsSender = false; ((ChatFormForWeb)FormObj).setFileReceivePath(file); //添加控件 ((ChatFormForWeb)FormObj).OPENFIRE_SendFile(file); } } break; case SysParams.Sys_File_Warming: this.AppendSysContent(browser, userID, originTime, content.Text, MineID, FriendID, color, followingWords, originTime != null); break; case SysParams.Sys_File_Cancel: //文件取消 if (!string.IsNullOrEmpty(content.Text)) { //subLength = SysParams.Sys_SendFileMessage.Length; sendContent = content.Text.Substring(SysParams.Sys_File_Cancel.Length); FileClass file = JsonConvert.DeserializeObject <FileClass>(sendContent); if (FormObj is ChatFormForWeb && file != null) { file.IsSender = false; //添加控件 ((ChatFormForWeb)FormObj).RemoveProgressBar(file, isOnload); } } this.AppendSysContent(browser, userID, originTime, content.Text, MineID, FriendID, color, followingWords, originTime != null); break; case SysParams.Sys_File_Success: if (!string.IsNullOrEmpty(content.Text)) { //subLength = SysParams.Sys_SendFileMessage.Length; sendContent = content.Text.Substring(SysParams.Sys_File_Success.Length); FileClass file = JsonConvert.DeserializeObject <FileClass>(sendContent); string sendName = userID; bool isSelf = false; if (file != null) { if (FormObj is ChatFormForWeb) { sendName = MineID; isSelf = true; } else if (FormObj is HistoryForm) { sendName = userID; if (userID != MineID) { sendName = MineID; isSelf = true; } else { return; } } } if (!string.IsNullOrEmpty(sendName) && sendName.Contains("@")) { sendName = sendName.Substring(0, sendName.IndexOf('@')); } if (file.IsSender) { this.addHistory_File(browser, isSelf, "完成", sendName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), file.IcoUrl, file.FileName, file.FileSize, SysParams.File_Send_Result, fontName, fontSize); } else { this.addHistory_File(browser, isSelf, "完成", sendName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), file.IcoUrl, file.ReceivePath, file.FileSize, string.Format(SysParams.File_Receive_Result, file.ReceivePath), fontName, fontSize); } } //this.AppendSysContent(browser, userID, originTime, content.Text,MineID,FriendID, color, followingWords, originTime != null); break; case SysParams.Sys_OffLine_SendFileMessage: //离线消息 sendContent = string.Empty; if (!string.IsNullOrEmpty(content.Text)) { subLength = SysParams.Sys_OffLine_SendFileMessage.Length; sendContent = content.Text.Substring(subLength); FileClass file = JsonConvert.DeserializeObject <FileClass>(sendContent); if (FormObj is ChatFormForWeb && file != null) { file.IsSender = false; //添加控件 ((ChatFormForWeb)FormObj).AddProcess_Receive(file, isOnload); } } break; case SysParams.Sys_OffLine_Success: sendContent = string.Empty; if (!string.IsNullOrEmpty(content.Text)) { subLength = SysParams.Sys_OffLine_Success.Length; sendContent = content.Text.Substring(subLength); FileClass file = JsonConvert.DeserializeObject <FileClass>(sendContent); this.AppendSysContent(browser, userID, originTime, content.Text, MineID, FriendID, color, followingWords, originTime != null); } break; } } }
public void AppendChatBoxContent(ChatBoxContent content) { try { if (content == null || content.Text == null) { return; } var count = this.Text.Length; if (content.EmotionDictionary != null) { var pureText = content.Text; //去掉表情和图片的占位符 var emotionPosList = new List <uint>(content.EmotionDictionary.Keys); var tempList = new List <uint>(); tempList.AddRange(emotionPosList); foreach (var key in content.ForeignImageDictionary.Keys) { tempList.Add(key); } tempList.Sort(); for (var i = tempList.Count - 1; i >= 0; i--) { pureText = pureText.Remove((int)tempList[i], 1); } this.AppendText(pureText); //插入表情 for (var i = 0; i < tempList.Count; i++) { var position = tempList[i]; if (emotionPosList.Contains(position)) { this.InsertDefaultEmotion(content.EmotionDictionary[position], (int)(count + position)); } else { this.InsertImage(content.ForeignImageDictionary[position], (int)(count + position)); } } } else { this.AppendText(content.Text); } this.Select(count, content.Text.Length); if (content.Color != null) { this.SelectionColor = content.Color; } if (content.Font != null) { this.SelectionFont = content.Font; } } catch (Exception ee) { MessageBox.Show(ee.Message); } }
//处理事件的程序 void ChatHandleReceive(object sender, EventArgs e, Msg msg) { if (Convert.ToUInt32(msg.FromUser) == item.ID) { ChatBoxContent content = new ChatBoxContent(); content.Text = msg.Content; this.AppendChatBoxContent(item.NicName,content); } }
/// <summary> /// Adds the latest message in the room, to the chatlog. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MessageRecieved(object sender, System.EventArgs e) { ChatBoxContent.ItemsSource = null; ChatBoxContent.ItemsSource = App.RoomManager.Room.Chatlog; ChatBoxContent.ScrollTo((ChatBoxContent.ItemsSource as List <Message>).Last(), ScrollToPosition.End, true); }
/// <summary> /// 发送信息文本到内容框 /// </summary> /// <param name="userName">名字</param> /// <param name="originTime">时间</param> /// <param name="content">发送内容</param> /// <param name="color">字体颜色</param> /// <param name="followingWords">是否有用户名</param> private void AppendChatBoxContent(string userName, DateTime?originTime, ChatBoxContent content, Color color, bool followingWords) { this.AppendChatBoxContent(userName, originTime, content, color, followingWords, originTime != null); }
private void OnReceivedMsg(ChatBoxContent content, DateTime?originTime) { this.AppendChatBoxContent(lblChatName.Tag == null ? "小黄鸡" : lblChatName.Tag.ToString(), originTime, content, Color.Blue, false); }
private void Form_Chat_Load(object sender, EventArgs e) { //连接数据库 msgDB = MsgDB.OpenMsgDB(myInfo.ID.ToString()); //取出聊天记录 List<Msg> msgs = msgDB.readMsg(contactInfo.ID.ToString(), myInfo.ID.ToString()); ChatBoxContent content = new ChatBoxContent(); foreach (Msg msg in msgs) { AppendChatBoxContent(msg); displayPicture(); } }