private void ReceiveNewMsg(HistoryMessageInfo msgInfo)
        {
            var flag = true;
            foreach (var item in NotifyInfo)
            {
                if (item.Info.TargetId == msgInfo.TargetId)
                {
                    flag = false;
                    item.Count += 1;
                }
            }

            if (flag)
            {
                Application.Current.Dispatcher.Invoke(new Action(() =>
                {
                    var info = new ConversationMessageInfo()
                    {
                        TargetId = msgInfo.TargetId,
                        UnreadCount = 1,
                        SenderId = msgInfo.SenderId,
                        SendTime = msgInfo.SendTime,
                        Type = msgInfo.Type,
                        TargertName = msgInfo.TargetName,
                        AvatarIcon = SystemConfig.AvatarUrl + msgInfo.TargetId
                    };

                    var conversatinInfoViewModel = new NotifyInfo(info);
                    NotifyInfo.Insert(0, conversatinInfoViewModel);
                }));
            }

            TotalCount = NotifyInfo.Count;
        }
 public ConversatinInfoViewModel(ConversationMessageInfo info, BusinessCoreService businessCoreService)
 {
     _content = info.Content;
     _info = info;
     _businessCoreService = businessCoreService;
     _count = info.UnreadCount;
 }
Example #3
0
 public static ConversationMessageInfo ParserConversation(RcReceiveMsg info)
 {
     var data = new ConversationMessageInfo()
     {
         TargetId = info.m_TargetId,
         ConversationType = info.m_ConversationType,
         UnreadCount = 1,
         SenderId = info.m_SenderId,
         SendTime = info.m_SendTime,
         Type = RcHelper.ParseMessageType(info.m_ClazzName),
         TargertName = info.m_ConversationType == ConversationType.PRIVATE ? _bussinessService.GetName(info.m_TargetId) : "群组",
         Content = ConversationContentParser(RcHelper.ParseMessageType(info.m_ClazzName), info.m_Message),
         AvatarIcon = SystemConfig.AvatarUrl + info.m_TargetId
     };
     return data;
 }
Example #4
0
 public NotifyInfo(ConversationMessageInfo info)
 {
     _info = info;
 }