protected override void ChatSignalHelperOnMessageReceived(MessageReceivedEventArgs eventArgs) { if (!eventArgs.ReceivedMessage.Sender.Username.Equals(Conversation.TargetUsername, StringComparison.CurrentCultureIgnoreCase)) { return; } var username = eventArgs.ReceivedMessage.Sender.Username; var message = eventArgs.ReceivedMessage.Message; var messageToShow = message.Replace("--urgent", string.Empty); if (!_viewProvider.IsMainWindowFocused()) { _viewProvider.ShowToastNotification( string.Format(CultureInfo.CurrentCulture, CappuChat.Properties.Strings.PrivateMessageNotification_UserName_Message, username, messageToShow), NotificationType.Dark, message.Contains("--urgent") ); } Messages.Add(new OwnSimpleMessage(eventArgs.ReceivedMessage)); _cappuMessageController.StoreMessage(eventArgs.ReceivedMessage); }
public void HandleReceivedMessage(SimpleMessage receivedMessage, bool pendingMessage = false) { var sender = receivedMessage.Sender.Username; if (!sender.Equals(Conversation.TargetUsername, StringComparison.CurrentCultureIgnoreCase)) { return; } var message = receivedMessage.Message; var messageToShow = message.Replace("--urgent", string.Empty); if (!_viewProvider.IsMainWindowFocused() && !pendingMessage) { _viewProvider.ShowToastNotification( string.Format(CultureInfo.CurrentCulture, CappuChat.Properties.Strings.PrivateMessageNotification_UserName_Message, sender, messageToShow), NotificationType.Dark, message.Contains("--urgent") ); } Messages.Add(new OwnSimpleMessage(receivedMessage)); _cappuMessageController.StoreMessage(receivedMessage); }