示例#1
0
 private static void OnTeamChanged(int resCode, int nid, string tid, string result, string jsonExtension, IntPtr userData)
 {
     if (userData != IntPtr.Zero)
     {
         NIMTeamEventData eventData = ParseTeamEventData(resCode, nid, tid, result);
         NimUtility.DelegateConverter.InvokeOnce <TeamChangedNotificationDelegate>(userData, eventData);
     }
 }
示例#2
0
 private static void NotifyTeamEvent(int resCode, int nid, string tid, string result, string jsonExtension, IntPtr userData)
 {
     if (TeamEventNotificationHandler != null)
     {
         NIMTeamEventData eventData = ParseTeamEventData(resCode, nid, tid, result);
         TeamEventNotificationHandler.Invoke(null, new NIMTeamEventArgs(eventData));
     }
 }
示例#3
0
        private static NIMTeamEventData ParseTeamEventData(int resCode, int nid, string tid, string result)
        {
            NIMTeamEventData    eventData        = null;
            NIMNotificationType notificationType = (NIMNotificationType)Enum.Parse(typeof(NIMNotificationType), nid.ToString());

            if (!string.IsNullOrEmpty(result))
            {
                try
                {
                    eventData = NIMTeamEventData.Deserialize(result);
                    if (eventData != null)
                    {
                        if (notificationType.Equals(NIMNotificationType.kNIMNotificationIdLocalGetTeamMsgUnreadCount) ||
                            notificationType.Equals(NIMNotificationType.kNIMNotificationIdLocalGetTeamMsgUnreadList))
                        {
                            NIMTeamEventDataObjects eventDataObjects = NIMTeamEventDataObjects.Deserialize(result);
                            if (eventDataObjects != null)
                            {
                                eventData.TeamEvents = eventDataObjects.TeamEventInfos;
                            }
                        }
                        else
                        {
                            NIMTeamEventDataObject eventDataObject = NIMTeamEventDataObject.Deserialize(result);
                            if (eventDataObject != null && eventDataObject.TeamEvent != null)
                            {
                                eventData.TeamEvent = eventDataObject.TeamEvent;
                            }
                            else
                            {
                                eventData.TeamEvent = new NIMTeamEvent();
                            }

                            eventData.TeamEvent.TeamId           = tid;
                            eventData.TeamEvent.ResponseCode     = (ResponseCode)Enum.Parse(typeof(ResponseCode), resCode.ToString());
                            eventData.TeamEvent.NotificationType = notificationType;
                        }
                    }
                }
                catch
                {
                    eventData      = new NIMTeamEventData();
                    eventData.JSON = result;
                }
            }
            if (eventData == null)
            {
                eventData      = new NIMTeamEventData();
                eventData.JSON = result;
            }
            eventData.NotificationId = notificationType;

            return(eventData);
        }
        private static NIMTeamEventData ParseTeamEventData(int resCode, int nid, string tid, string result)
        {
            NIMTeamEventData eventData = null;

            if (!string.IsNullOrEmpty(result))
            {
                eventData = NIMTeamEventData.Deserialize(result);
                if (eventData.TeamEvent == null)
                {
                    eventData.TeamEvent = new NIMTeamEvent();
                }
                eventData.TeamEvent.TeamId           = tid;
                eventData.TeamEvent.ResponseCode     = (ResponseCode)Enum.Parse(typeof(ResponseCode), resCode.ToString());
                eventData.TeamEvent.NotificationType = (NIMNotificationType)Enum.Parse(typeof(NIMNotificationType), nid.ToString());
            }
            return(eventData);
        }
示例#5
0
 public NIMTeamEventArgs(NIMTeamEventData data)
 {
     Data = data;
 }