private void OnConsoleMessage(MessageAddedEvent mess)
 {
     Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
     {
         tbConsoleMessages.Text = $"{mess.Message.Level}: {mess.Message.Text} {Environment.NewLine}" + tbConsoleMessages.Text;
     });
 }
Exemple #2
0
        public async Task Handle(MessageAddedEvent message) // Notify the "to" that a message has been sent.
        {
            var notification = new NotificationAggregate
            {
                Id              = Guid.NewGuid().ToString(),
                Content         = "add_message",
                IsRead          = false,
                From            = message.From,
                To              = message.To,
                CreatedDateTime = DateTime.UtcNow,
                Parameters      = new[]
                {
                    new NotificationParameter
                    {
                        Id    = Guid.NewGuid().ToString(),
                        Type  = NotificationParameterTypes.MessageId,
                        Value = string.IsNullOrWhiteSpace(message.ParentId) ? message.Id : message.ParentId
                    }
                }
            };

            await _notificationRepository.Add(notification);

            _eventPublisher.Publish(new NotificationAddedEvent
            {
                Id      = notification.Id,
                Content = notification.Content,
                IsRead  = notification.IsRead,
                From    = notification.From,
                To      = notification.To
            });
        }
 protected virtual void OnMessageAdded(IMessage m)
 {
     if (m.GetType().IsInstanceOfType(typeof(IErrorMessage)))
     {
         ErrorMessageAddedEvent?.Invoke(this, m as IErrorMessage);
     }
     MessageAddedEvent?.Invoke(this, m);
 }
        public void AddMessage(EzspIncomingMessageHandlerResponse message, ZigbeeDeviceBase device)
        {
            lock (Messages)
            {
                Messages.Enqueue(Tuple.Create(message, device));
            }

            MessageAddedEvent?.Invoke();
        }
Exemple #5
0
        public void SaveMessage(string message)
        {
            // ToDo: Save the message
            // ....

            var messageEvent = new MessageAddedEvent()
            {
                Message = message,
                Sender  = this
            };

            this.EventHub?.Publish(messageEvent);
        }
 private void MessageAddedHandler(MessageAddedEvent messageAddedEvent)
 {
     this.Message += messageAddedEvent.Message + Environment.NewLine;
 }