コード例 #1
0
        public async Task <ActionResult> LoadPrivateMessageDetails(string msgId)
        {
            var hub = new SignalRHubs.NotificationHub();
            var msg = await PrivateChatViewContext.LoadMessageDetails(hub.HubIdentity, User.Identity.GetUserId(), msgId);

            return(Json(msg));
        }
コード例 #2
0
        private async Task HandleNotification(string uid, OperationResult OpResult)
        {
            if (OpResult.notices != null)
            {
                var member = await NotificationContext.SetNotification(uid, OpResult.notices);

#if !NO_SIGNALR
                var nhub  = new SignalRHubs.NotificationHub();
                var mbhub = (from d in member.ChangedMemberCallbacks where d.HubID == nhub.HubIdentity select d).SingleOrDefault();
                if (IsSignalREnabled && mbhub != null && mbhub.ConnectionID != null && !mbhub.IsDisconnected)
                {
                    var lcateg = await NotificationContext.GetRecentCategorized(uid, OpResult.notices, 1, 15);

                    List <dynamic> lmsg = new List <dynamic>();
                    foreach (var n in OpResult.notices)
                    {
                        lmsg.Add(new
                        {
                            title    = n.Title,
                            msg      = n.Message,
                            priority = n.Priority
                        });
                    }
                    List <dynamic> categs = new List <dynamic>();
                    foreach (var categ in lcateg)
                    {
                        string         categ_name = NotificationContext.MapCategoryName(categ, member.AcceptLanguages);
                        List <dynamic> l          = new List <dynamic>();
                        foreach (var n in categ.ChangedMemberNotifications)
                        {
                            l.Add(new
                            {
                                title    = n.DistinctString,
                                msg      = "",
                                priority = n.PriorityLevel
                            });
                        }
                        categs.Add(new
                        {
                            name = categ_name,
                            list = l.ToArray()
                        });
                    }
                    NoticeContext.Clients.Client(mbhub.ConnectionID).serverNotifications(1, lmsg.ToArray(), categs);
                }
#endif
            }
        }
コード例 #3
0
        private async Task HandleNotification(string uid, OperationResult OpResult)
        {
            if (OpResult.notices != null)
            {
                var member = await NotificationContext.SetNotification(uid, OpResult.notices);
#if !NO_SIGNALR
                var nhub = new SignalRHubs.NotificationHub();
                var mbhub =(from d in member.ChangedMemberCallbacks where d.HubID == nhub.HubIdentity select d).SingleOrDefault();
                if (IsSignalREnabled && mbhub != null && mbhub.ConnectionID != null && !mbhub.IsDisconnected)
                {
                    var lcateg = await NotificationContext.GetRecentCategorized(uid, OpResult.notices, 1, 15);
                    List<dynamic> lmsg = new List<dynamic>();
                    foreach (var n in OpResult.notices)
                    {
                        lmsg.Add(new
                        {
                            title = n.Title,
                            msg = n.Message,
                            priority = n.Priority
                        });
                    }
                    List<dynamic> categs = new List<dynamic>();
                    foreach (var categ in lcateg)
                    {
                        string categ_name = NotificationContext.MapCategoryName(categ, member.AcceptLanguages);
                        List<dynamic> l = new List<dynamic>();
                        foreach (var n in categ.ChangedMemberNotifications)
                        {
                            l.Add(new
                            {
                                title = n.DistinctString,
                                msg = "",
                                priority = n.PriorityLevel
                            });
                        }
                        categs.Add(new
                        {
                            name = categ_name,
                            list = l.ToArray()
                        });
                    }
                    NoticeContext.Clients.Client(mbhub.ConnectionID).serverNotifications(1, lmsg.ToArray(), categs);
                }
#endif
            }
        }
コード例 #4
0
 public async Task<ActionResult> LoadPrivateMessageDetails(string msgId)
 {
     var hub = new SignalRHubs.NotificationHub();
     var msg = await PrivateChatViewContext.LoadMessageDetails(hub.HubIdentity, User.Identity.GetUserId(), msgId);
     return Json(msg);
 }
コード例 #5
0
 public async Task<ActionResult> GetPrivateMessages(string set, string qexpr, string prevlast)
 {
     var hub = new SignalRHubs.NotificationHub();
     var msgs = await PrivateChatViewContext.GetMessages(hub.HubIdentity, User.Identity.GetUserId(), set, qexpr, prevlast);
     return Json(msgs);
 }