コード例 #1
0
ファイル: EaseHelper.cs プロジェクト: wuearl/imPC
        /// <summary>
        /// 获取会话列表
        /// </summary>
        /// <returns></returns>
        public List <EMConversation> getAllConversation()
        {
            var con = client.getChatManager().getConversations();
            List <EMConversation> mConversations = new List <EMConversation>();

            foreach (var c in con)
            {
                mConversations.Add(c);
            }
            return(mConversations);
        }
コード例 #2
0
ファイル: EaseHelper.cs プロジェクト: wuearl/imPC
        private EaseHelper()
        {
            EMChatConfigs configs = new EMChatConfigs(System.Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\Changliao", /*System.Environment.GetFolderPath(Environment.SpecialFolder.Personal)+ "\\Changliao"*/ System.Environment.CurrentDirectory, AppSettingHelper.getAppConfig("hxKey"), 0);

            client = EMClient.create(configs);
            queue  = new BackgroundQueue();
            ChangLiaoConnection              = new EMConnectionListener();
            ChangLiaoConnection.onConntect   = onConnect;
            ChangLiaoConnection.onDisconnect = onDisconnect;
            ChangLiaoConnection.onPong       = onPong;
            client.addConnectionListener(ChangLiaoConnection);
            ChangLiaoChatManager = new EMChatManagerListener();
            ChangLiaoChatManager.onReceiveMessages    = onReciveMessage;
            ChangLiaoChatManager.onReceiveCmdMessages = onReciveCmdMessage;
            ContactListener = new EMContactListener();
            ContactListener.onContactAdded   = onContactAdded;
            ContactListener.onContactDeleted = onContactDeleted;
            ContactListener.onContactInvited = onContactInvited;
            client.getChatManager().addListener(ChangLiaoChatManager);
            client.getContactManager().registerContactListener(ContactListener);
            GroupManagerListener = new EMGroupManagerListener();
            GroupManagerListener.onLeaveGroup = onLeaveGroup;
            GroupManagerListener.onReceiveJoinGroupApplication   = onReceiveJoinGroupApplication;
            GroupManagerListener.onMemberLeftGroup               = onMemberLeaveGroup;
            GroupManagerListener.onMemberJoinedGroup             = onMemberJoinedGroup;
            GroupManagerListener.onAutoAcceptInvitationFromGroup = onAutoAcceptInvitationFromGroup;
            GroupManagerListener.onUpdateMyGroupList             = onUpdateMyGroupList;
            client.getGroupManager().addListener(GroupManagerListener);
            relogin = false;
        }