Exemplo n.º 1
0
 private static void OnMemberLeftCallback(int id, IntPtr channelMemberPtr)
 {
     if (channelEventHandlerDic.ContainsKey(id) && channelEventHandlerDic[id].OnMemberLeft != null)
     {
         if (AgoraCallbackObject.GetInstance()._CallbackQueue != null)
         {
             string           userId           = Marshal.PtrToStringAnsi(channel_member_getUserId(channelMemberPtr));
             string           channelId        = Marshal.PtrToStringAnsi(channel_member_getChannelId(channelMemberPtr));
             RtmChannelMember rtmChannelMember = new RtmChannelMember(userId, channelId);
             AgoraCallbackObject.GetInstance()._CallbackQueue.EnQueue(() => {
                 if (channelEventHandlerDic.ContainsKey(id) && channelEventHandlerDic[id].OnMemberLeft != null)
                 {
                     channelEventHandlerDic[id].OnMemberLeft(id, rtmChannelMember);
                 }
             });
         }
     }
 }
Exemplo n.º 2
0
 private static void OnGetMemberCallback(int id, string membersStr, int userCount, GET_MEMBERS_ERR errorCode)
 {
     if (channelEventHandlerDic.ContainsKey(id) && channelEventHandlerDic[id].OnGetMembers != null)
     {
         if (AgoraCallbackObject.GetInstance()._CallbackQueue != null)
         {
             AgoraCallbackObject.GetInstance()._CallbackQueue.EnQueue(() => {
                 if (channelEventHandlerDic.ContainsKey(id) && channelEventHandlerDic[id].OnGetMembers != null)
                 {
                     int j           = 1;
                     string[] sArray = membersStr.Split('\t');
                     RtmChannelMember [] membersList = new RtmChannelMember[userCount];
                     for (int i = 0; i < userCount; i++)
                     {
                         RtmChannelMember member = new RtmChannelMember(sArray[j++], sArray[j++]);
                         membersList[i]          = member;
                     }
                     channelEventHandlerDic[id].OnGetMembers(id, membersList, userCount, errorCode);
                 }
             });
         }
     }
 }