コード例 #1
0
        public static IDisposable BindNotifications(
            this MessengerModel model,
            INotificationSource notificationSource,
            INotificationController notificationController)
        {
            var chats    = notificationSource.ChatNotifications();
            var messages = notificationSource.MessagesNotifications();

            return(chats.Merge(messages)
                   .Buffer(TimeSpan.FromSeconds(2))
                   .SubscribeOn(RxApp.TaskpoolScheduler)
                   .ObserveOn(RxApp.MainThreadScheduler)
                   .Accept(notifications =>
            {
                switch (notifications.Count)
                {
                case 0:
                    break;

                case 1:
                    notificationController.Show(
                        NotificationModel.FromNotification(notifications[0]));
                    break;

                default:
                    notificationController.Show(
                        NotificationModel.FromNotificationList(notifications));
                    break;
                }
            }));
        }
コード例 #2
0
 public NotificationConnector(
     INotificationSource source, INotificationTransport transport)
 {
     this.source    = source;
     this.transport = transport;
 }
コード例 #3
0
 public async Task PermanentNotifyAsync(string[] tokenIds, string type, INotificationSource sourse)
 => await NotifyAsync(_permanentConnectionService.GetConnections(tokenIds), type, sourse);
コード例 #4
0
 public async Task NotifyAsync(string[] userIds, INotificationSource sourse, string type)
 => await NotifyAsync(_userConnectionService.GetUserConnections(userIds), type, sourse);
コード例 #5
0
 public async Task NotifyAsync(string userId, string tokenId, string type, INotificationSource sourse)
 => await NotifyAsync(_userConnectionService.GetUserConnections(userId, tokenId), type, sourse);
コード例 #6
0
 public async Task NotifyAsync(string[] conns, string type, INotificationSource sourse)
 => await _hubContext.Clients.Clients(conns).SendAsync(methodNotificationName, new NotificationDto
 {
     Type   = type,
     Source = sourse
 });