Exemplo n.º 1
0
        private async void DisplayPastMessagesAsync(IEnumerable <ChatMessage> messages)
        {
            foreach (ChatMessage message in messages)
            {
                if (!message.IsOutgoing)
                {
                    IncomingChatBubble bubble = new IncomingChatBubble(message);
                    bubble.MessageDeleted += bubble_MessageDeleted;
                    bubble.DownloadImage  += bubble_DownloadImage;
                    bubble.ImageTapped    += Bubble_ImageTapped;
                    bubble.RefreshImage();
                    MessagesList.Children.Add(bubble);
                }
                else
                {
                    if (!message.IsText && message.FileTransferInformation != null)
                    {
                        var         tempFolder = ApplicationData.Current.LocalFolder;
                        string      name       = message.FileTransferInformation.Name;
                        StorageFile tempFile   = await tempFolder.GetFileAsync(name.Substring(0, name.IndexOf('.')));

                        message.FileTransferFilepath = tempFile.Path;
                    }
                    OutgoingChatBubble bubble = new OutgoingChatBubble(message);
                    bubble.MessageDeleted += bubble_MessageDeleted;
                    bubble.UpdateStatus(message.State);
                    bubble.RefreshImage();
                    MessagesList.Children.Add(bubble);
                }
            }
        }
Exemplo n.º 2
0
 private void DisplayPastMessages(IList <Object> messages)
 {
     foreach (LinphoneChatMessage message in messages)
     {
         if (!message.IsOutgoing)
         {
             IncomingChatBubble bubble = new IncomingChatBubble(message);
             bubble.MessageDeleted += bubble_MessageDeleted;
             bubble.DownloadImage  += bubble_DownloadImage;
             MessagesList.Children.Insert(MessagesList.Children.Count - 1, bubble);
         }
         else
         {
             OutgoingChatBubble bubble = new OutgoingChatBubble(message);
             bubble.MessageDeleted += bubble_MessageDeleted;
             bubble.UpdateStatus(message.State);
             MessagesList.Children.Insert(MessagesList.Children.Count - 1, bubble);
         }
     }
     scrollToBottom();
 }
Exemplo n.º 3
0
 private void DisplayPastMessages(IList <ChatMessage> messages)
 {
     foreach (ChatMessage message in messages)
     {
         if (!message.IsOutgoing)
         {
             IncomingChatBubble bubble = new IncomingChatBubble(message);
             bubble.MessageDeleted += bubble_MessageDeleted;
             bubble.DownloadImage  += bubble_DownloadImage;
             bubble.ImageTapped    += Bubble_ImageTapped;
             MessagesList.Children.Add(bubble);
         }
         else
         {
             OutgoingChatBubble bubble = new OutgoingChatBubble(message);
             bubble.MessageDeleted += bubble_MessageDeleted;
             bubble.UpdateStatus(message.State);
             MessagesList.Children.Add(bubble);
         }
     }
     scrollToBottom();
 }