private void Bind() { DataTable table = new DataTable(); switch (imageTabBar1.SelectItemIndex) { case 0: GridView1.Layout = "frmContentLayout"; COMSSmobilerDemo.common.frmContact frmConcat = new COMSSmobilerDemo.common.frmContact(); table = frmConcat.GetContactData(); break; case 1: GridView1.Layout = "frmGroupLayout"; COMSSmobilerDemo.common.frmGroup frmGroup = new COMSSmobilerDemo.common.frmGroup(); table = frmGroup.GetGroupData(); break; } if (table.Rows.Count > 0) { GridView1.DataSource = table; GridView1.DataBind(); } else { GridView1.Rows.Clear(); } }
/// <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(""); } })); }