private void GridView1_ItemClick(object sender, GridViewCellItemEventArgs e) { if (isGroup == true) { getGroupuserCount(); } else { string userid = e.Cell.Items["lblUSER_ID"].Text; if (string.IsNullOrEmpty(userid) == false) { //添加用户 string token = im.CreateUser(userid, userid, ".\\Image\\" + e.Cell.Items["imgPortraitUri"].DefaultValue + ".PNG"); if (im != null) { //添加联系人到数据库 MessageBox.Show("联系人已添加", (Object s, MessageBoxHandlerArgs args) => Bind()); } else { Toast("联系人添加失败"); } } } }