// you have ben removed from friends private async void RemovedFromeFriends(string login, DateTime time) { await System.Threading.Tasks.Task.Run(() => System.Threading.Thread.Sleep(Properties.Settings.Default.ActionDelayMsec)); FriendsList.Remove(FriendsList.FirstOrDefault(x => x.Name.Equals(login))); }
// your request for friendship accepted private async void FriendshipAccepted(string login, DateTime time) { await System.Threading.Tasks.Task.Run(() => System.Threading.Thread.Sleep(Properties.Settings.Default.ActionDelayMsec)); if (FriendsList.FirstOrDefault(x => x.Name.Equals(login)) == null) { FriendsList.Add(new Friend(client, login, true)); } }
// update friend status private void FriendGoOffline(string login) { if (!string.IsNullOrEmpty(login)) { Friend f = FriendsList.FirstOrDefault(x => x.Name.Equals(login)); if (f != null) { f.IsOnline = false; } } }
// update conversations private void NewReply(string interlocutor, ConversationReply reply) { if (SelectedFriend != null && interlocutor == SelectedFriend.Name) { RepliesList.Add(new Reply(reply, client.Name)); } else { Friend f = FriendsList.FirstOrDefault(x => x.Name.Equals(interlocutor)); if (f != null) { f.HasUnreadMessages = true; } } }