/// <summary> /// 添加用户 /// </summary> /// <param name="user"></param> public void AddUser(FaceUser user) { if (user != null) { //将待添加的用户所属组别设置好 user.BelongGroup = this; UserList.Add(user); } }
/// <summary> /// 删除用户,若用户不存在则无动作 /// </summary> /// <param name="user"></param> public void DeleteUser(FaceUser user) { int index = UserList.IndexOf(user); if (index >= 0) { UserList.RemoveAt(index); } }
/// <summary> /// 切换为子节点的时候显示图片 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeView_group_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { //判断是子节点 TreeNode thisNode = treeView_group.SelectedNode; if (thisNode != null && thisNode.Level == 1) { FaceGroup belongGroup = FaceGroup.GroupList.GetGroupByname(thisNode.Parent.Text); FaceUser user = belongGroup.UserList.GetUserByName(thisNode.Text); Bitmap tmp = LocalImageHelp.Base64str2Image(user.imagebase64); pictureBox1.Image = tmp; } else { pictureBox1.Image = null; } }