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); } }
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)); } }
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); }
public NIMTeamEventArgs(NIMTeamEventData data) { Data = data; }