//删除好友 public void DeleteFriend(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("删除该好友?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question); if (MessageBoxResult.OK == result) { //进行删除好友的操作 //将删除好友的信息发送给服务端,由服务端同时删除用户和好友的好友表中的对应ID JObject obj = new JObject(); obj["Id"] = this.Id; String str = obj.ToString(); MClient mClient = MClient.CreateInstance(); mClient.SendDeleteFriend(str); //同时客户端本地将该好友从队列中删除 SqliteConnect.DeleteFriendById(this.Id); //然后从好友队列中删除 Application.Current.Dispatcher.Invoke( new Action(() => { FriendListViewModel friendListViewModel = FriendListViewModel.CreateInstance(); FriendEntity.InGroupListDelete(friendListViewModel.friendGroups, this.Id); }) ); } }
public static FriendListViewModel CreateInstance() { if (friendListViewModel == null) { friendListViewModel = new FriendListViewModel(); } return(friendListViewModel); }