Ejemplo n.º 1
0
        private void ChatSignalHelperOnPrivateMessageReceived(MessageReceivedEventArgs eventArgs)
        {
            var username = eventArgs.ReceivedMessage.Sender.Username;

            TryAddCappuChatViewModel(username, false, eventArgs.ReceivedMessage);
            _viewProvider.FlashWindow();
        }
Ejemplo n.º 2
0
        protected override void SignalHelperOnMessageReceived(MessageReceivedEventArgs eventArgs)
        {
            var ownSimpleMessage = new OwnSimpleMessage(eventArgs.ReceivedMessage);

            if (!string.IsNullOrWhiteSpace(eventArgs.ReceivedMessage.Base64ImageString))
            {
                var memoryStream = new MemoryStream(Convert.FromBase64String(eventArgs.ReceivedMessage.Base64ImageString));
                ownSimpleMessage.ImageStream = memoryStream;
                _imageHelper.AddImageStream(memoryStream, eventArgs.ReceivedMessage.ImageName);
            }

            Messages.Add(ownSimpleMessage);
            Application.Current.Dispatcher.Invoke(() => { });

            string message  = eventArgs.ReceivedMessage.Message;
            string username = SignalHelperFacade.LoginSignalHelper.User.Username;

            if (message.Contains($"@{username}", StringComparison.CurrentCultureIgnoreCase))
            {
                if (!_viewProvider.IsMainWindowFocused())
                {
                    _viewProvider.ShowToastNotification($"{eventArgs.ReceivedMessage.Sender.Username}: {message}", NotificationType.Dark);
                }
            }

            _viewProvider.FlashWindow();
        }
Ejemplo n.º 3
0
        private void HandleMessageReceived(SimpleMessage receivedMessage)
        {
            var username = receivedMessage.Sender.Username;

            TryAddCappuChatViewModel(username, false, receivedMessage);
            _viewProvider.FlashWindow();
        }