private async void Load() { var participant = ChatConversation.Participants.First(); var contact = await ContactUtils.BindPhoneNumberToGlobalContact(participant); var messageReader = ChatConversation.GetMessageReader(); var lastMessageId = ChatConversation.MostRecentMessageId; var messages = await messageReader.ReadBatchAsync(); var lastMessage = messages.Where(x => x.Id == lastMessageId).First(); DisplayMessage = lastMessage.Body; DisplayDate = lastMessage.LocalTimestamp.LocalDateTime.ToString(); Contact = contact; DisplayName = contact.DisplayName; ChatName.Text = DisplayName; ChatDate.Text = DisplayDate; PeoplePic.Contact = Contact; ChatContent.Text = DisplayMessage; }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); var args = e.Parameter as ChatConversation; if (args != null) { convo = args; } var contact = await ContactUtils.BindPhoneNumberToGlobalContact(convo.Participants.First()); ConvoTitle.Text = contact.DisplayName; ConvoPic.Contact = contact; var reader = convo.GetMessageReader(); var messages = await reader.ReadBatchAsync(); messages.ToList().ForEach(x => observableCollection.Insert(0, new ChatMessageViewControl(x))); Load(); }