private Friend UpdateChatPanel(string FriendName, Image image, DialogueType t = DialogueType.PeerText, bool IsGroup = false)//更新对话框信息 { bool HasFound = false; Friend TempFriend; int i = 0; while (i < MyFriendList.Count) { if (MyFriendList[i].Name == FriendName) { HasFound = true; break; } i++; } if (!HasFound) { if (IsGroup == true) { TempFriend = new Friend(FriendName, image, true); } else { TempFriend = new Friend(FriendName, image); } TempFriend.setFront += new SetFront(setfront);//增加委托触发 MyFriendList.Add(TempFriend); } else { TempFriend = MyFriendList[i]; if (t == DialogueType.PeerText) { TempFriend.AddPeerEmoji(image); } else if (t == DialogueType.MyText) { TempFriend.AddMyEmoji(image); } } return(TempFriend); }
private Friend UpdateChatPanel(string FriendName, string word = "", DialogueType t = DialogueType.PeerText, bool IsGroup = false)//更新对话框信息 { bool HasFound = false; Friend TempFriend; int i = 0; while (i < MyFriendList.Count) { if (MyFriendList[i].Name == FriendName) { HasFound = true; break; } i++; } if (!HasFound) { if (IsGroup == true) { if (word != string.Empty) { TempFriend = new Friend(FriendName, word, true);//新生成朋友类时生成标签 } else { TempFriend = new Friend(FriendName, "我们可以开始聊天啦", true); } } else { if (word != string.Empty) { TempFriend = new Friend(FriendName, word);//新生成朋友类时生成标签 } else { TempFriend = new Friend(FriendName); } } TempFriend.setFront += new SetFront(setfront);//对话框置前 MyFriendList.Add(TempFriend); } else { TempFriend = MyFriendList[i]; if (word == string.Empty) { word = "我们又见面啦!"; } if (t == DialogueType.PeerText) { TempFriend.AddPeerText(word); } else if (t == DialogueType.MyText) { TempFriend.AddMyText(word); } else if (t == DialogueType.PeerFile) { TempFriend.AddPeerText(word, true); } } return(TempFriend); }