private void DisplayNotification(RtmMessageModel message)
        {
            if (MainWindow.Form.InvokeRequired)
            {
                MainWindow.Form.Invoke((Action)(delegate { DisplayNotification(message); }));
                return;
            }

            var existingNotification = _openNotifications.FirstOrDefault(x => x.Key == message.ChannelId).Value;

            // Don't create new notifications for messages posted by the current user
            if (existingNotification != null || message.IsIncoming)
            {
                if (existingNotification == null)
                {
                    existingNotification = new Notification(message.ChannelId, message.ChannelName, 20,
                        FormAnimator.AnimationMethod.Slide, FormAnimator.AnimationDirection.Up);
                    existingNotification.Closed += OnChannelClosed;
                    existingNotification.OnQuickReply += OnChannelQuickReply;
                    existingNotification.OnSnooze += OnNotificationSnoozeClick;

                    existingNotification.Show();
                    _openNotifications.Add(message.ChannelId, existingNotification);
                }

                existingNotification.AddMessage(message.User, message.MessageText, message.IsIncoming);
            }
        }
Exemple #2
0
        private void DisplayNotification(RtmMessageModel message)
        {
            if (MainWindow.Form.InvokeRequired)
            {
                MainWindow.Form.Invoke((Action)(delegate { DisplayNotification(message); }));
                return;
            }

            var existingNotification = _openNotifications.FirstOrDefault(x => x.Key == message.ChannelId).Value;

            // Don't create new notifications for messages posted by the current user
            if (existingNotification != null || message.IsIncoming)
            {
                if (existingNotification == null)
                {
                    existingNotification = new Notification(message.ChannelId, message.ChannelName, 20,
                                                            FormAnimator.AnimationMethod.Slide, FormAnimator.AnimationDirection.Up);
                    existingNotification.Closed       += OnChannelClosed;
                    existingNotification.OnQuickReply += OnChannelQuickReply;
                    existingNotification.OnSnooze     += OnNotificationSnoozeClick;

                    existingNotification.Show();
                    _openNotifications.Add(message.ChannelId, existingNotification);
                }

                existingNotification.AddMessage(message.User, message.MessageText, message.IsIncoming);
            }
        }
Exemple #3
0
        private void SnoozeMessage(RtmMessageModel message)
        {
            if (!_snoozedMessages.ContainsKey(message.ChannelId))
            {
                _snoozedMessages[message.ChannelId] = new List <RtmMessageModel>();
            }

            _snoozedMessages[message.ChannelId].Add(message);
        }
 public void ProcessMessage(RtmMessageModel message)
 {
     if (_snoozingService.IsDndMode || _snoozingService.IsChannelSnoozed(message.ChannelId))
     {
         SnoozeMessage(message);
     }
     else
     {
         DisplayNotification(message);
     }
 }
Exemple #5
0
 public void ProcessMessage(RtmMessageModel message)
 {
     if (_snoozingService.IsDndMode || _snoozingService.IsChannelSnoozed(message.ChannelId))
     {
         SnoozeMessage(message);
     }
     else
     {
         DisplayNotification(message);
     }
 }
        private void SnoozeMessage(RtmMessageModel message)
        {
            if (!_snoozedMessages.ContainsKey(message.ChannelId))
            {
                _snoozedMessages[message.ChannelId] = new List<RtmMessageModel>();
            }

            _snoozedMessages[message.ChannelId].Add(message);
        }