//得到群聊列表 private void get_group_list() { string search_text = "Select * from group_table"; all_chat_group = My_Database.SQLite_Select_all(search_text, connection); foreach (chat_group group in all_chat_group) { string[] group_username = group.user.Split('.'); foreach (string user in group_username) { if (user == user_name) { ListViewItem new_item = new ListViewItem(group.group_name); listView_group.Items.Add(new_item); } } } }
//找到用户列表对应的群聊名称 private string findGroup(List <string> all_name) { string search_text = "Select * from group_table"; List <chat_group> all_chat_group = My_Database.SQLite_Select_all(search_text, connection); foreach (chat_group group in all_chat_group) { List <string> all_user = group.user.Split('.').ToList(); all_user.Sort(); List <string> temp_user = new List <string>(all_name); temp_user.Sort(); if (all_user.All(temp_user.Contains) && all_user.Count == temp_user.Count) { return(group.group_name); } } return(""); }