private void PopulateMessageCollection() { var messageList = IMService.GetAllMessagesBetweenContacts(LoggedInUser, GetSelectedUser()); foreach (var message in messageList) { MessagesCollection.Add(message); } }
private void CheckForNewMessagesAndContacts() { if (LoggedInUser != null && SelectedContact != null) { var messagesList = IMService.GetAllMessagesBetweenContacts(LoggedInUser, GetSelectedUser()); foreach (var message in messagesList) { if (MessagesCollection.Count(c => c.Id == message.Id) == 0) { MessagesCollection.Add(message); } } var contactsList = IMService.GetContacts(LoggedInUser); foreach (var contact in contactsList) { if (ContactsCollection.Count(c => c.Username == contact.Username) == 0) { ContactsCollection.Add(contact); AddToContactsDetails(contact); } } } }