public void EqualsDifferentIDShouldReturnFalse() { ChatMessage test0 = new ChatMessage("Hello, world!", "MSA"); ChatMessage test1 = new ChatMessage("Hello, world!1!", "MSA"); Assert.That(!test0.Equals(test1)); }
public void EqualsACopyShouldReturnTrue() { ChatMessage test0 = new ChatMessage("Hello, world!", "MSA"); ChatMessage test1 = new ChatMessage("Hello, world!", "MSA"); Assert.That(test0.Equals(test1)); }
public void EqualsNullShouldReturnFalse() { ChatMessage test = new ChatMessage("Hello, world!", "MSA"); Assert.IsFalse(test.Equals(null)); }
public void EqualsItselfShouldReturnTrue() { ChatMessage test = new ChatMessage("Hello, world!", "MSA"); Assert.That(test.Equals(test)); }
/* private void cm_ContactFound(object sender, ContactFoundEventArgs e) * { * if (e.ContactFound != null) * { * ContactName.Text = e.ContactFound.DisplayName; * ContactManager.Instance.TempContact = e.ContactFound; * ContactName.Tap += ContactName_Tap; * * ContactName.Visibility = Visibility.Visible; * NewChat.Visibility = Visibility.Collapsed; * } * }*/ /* private void ContactName_Tap(object sender, System.Windows.Input.GestureEventArgs e) * { * NavigationService.Navigate(new Uri("/Views/Contact.xaml", UriKind.RelativeOrAbsolute)); * }*/ public void MessageStateChanged(ChatMessage message, ChatMessageState state) { if (LinphoneManager.Instance.CoreDispatcher == null) { return; } #pragma warning disable CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel LinphoneManager.Instance.CoreDispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { if (ProgressPopup.Visibility == Visibility.Visible) { ProgressPopup.Visibility = Visibility.Collapsed; MessageBox.Visibility = Visibility.Visible; } if (state == ChatMessageState.Delivered) { if (messageUploading != null && messageUploading.Equals(message)) { messageUploading = null; } } if (state == ChatMessageState.InProgress && message.IsOutgoing && messageUploading == null) { // Create the chat bubble for both text or image messages if (message.Appdata != null && messageUploading == null) { messageUploading = message; } OutgoingChatBubble bubble = new OutgoingChatBubble(message); bubble.MessageDeleted += bubble_MessageDeleted; MessagesList.Children.Add(bubble); scrollToBottom(); } else if (state == ChatMessageState.FileTransferDone && !message.IsOutgoing) { try { IncomingChatBubble bubble = (IncomingChatBubble)MessagesList.Children.OfType <IncomingChatBubble>().Where(b => message.Equals(((IncomingChatBubble)b).ChatMessage)).Last(); if (bubble != null) { ((IncomingChatBubble)bubble).ChatMessage.FileTransferFilepath = message.FileTransferFilepath; ((IncomingChatBubble)bubble).RefreshImage(); } EnableDownloadButtons(true); } catch { Debug.WriteLine("Cannot create load download image"); } } else if (state == ChatMessageState.FileTransferDone && message.IsOutgoing) { try { OutgoingChatBubble bubble = (OutgoingChatBubble)MessagesList.Children.OfType <OutgoingChatBubble>().Where(b => message.Equals(((OutgoingChatBubble)b).ChatMessage)).Last(); if (bubble != null) { ((OutgoingChatBubble)bubble).ChatMessage.FileTransferFilepath = message.FileTransferFilepath; ((OutgoingChatBubble)bubble).RefreshImage(); } } catch { Debug.WriteLine("Cannot load uploaded image"); } } else { try { foreach (OutgoingChatBubble bubble in MessagesList.Children.OfType <OutgoingChatBubble>()) { if (bubble.ChatMessage.Equals(message)) { bubble.UpdateStatus(state); } } } catch { Debug.WriteLine("Cannot update message state"); } } if (chatRoom != null) { chatRoom.MarkAsRead(); } }); }