Beispiel #1
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        /// <remarks></remarks>

        private void InitialIM()
        {
            im.LoadGroupInfoHandler = (new IMLoadGroupInfoHandler(id =>
            {
                IMGroupEntry group = new IMGroupEntry();
                COMSSmobilerDemo.common.frmGroup frmGroup = new COMSSmobilerDemo.common.frmGroup();
                group.GroupID = id;
                group.GroupName = "Smobiler交流群";
                // group.PortraitUri = "http://www.rongcloud.cn/images/logo.png"
                return(group);
            }));
            im.LoadUserInfoHandler = (new IMLoadUserInfoHandler(id =>
            {
                IMUserEntry user = new IMUserEntry();
                user.UserID = id;
                user.UserName = id;
                user.PortraitUri = ".\\Image\\" + id + ".PNG";
                return(user);
            }));
            im.LoadGroupMembersHandler = (new IMLoadGroupMembersHandler(id =>
            {
                return(new string[] { "Demo", "A", "B" });
            }));
            im.TokenExpiredHandler = (new IMTokenExpiredHandler(id =>
            {
                string userid = Client.Session ["UserID"].ToString();
                if (im != null && System.String.IsNullOrEmpty(userid) == false)
                {
                    //重置当前的用户Token

                    im.Token = im.GetUserToken(userid, userid, ".\\Image\\" + userid + ".PNG");
                    //返回Token
                    return(im.Token);
                }
                else
                {
                    return("");
                }
            }));
        }