private void buttonEditUser_Click(object sender, EventArgs e) { if (treeViewUser.SelectedNode != null && treeViewUser.SelectedNode.Level == 0) { string name = treeViewUser.SelectedNode.Name; bool fk = Users.Where(x => x.Name == name).First().FK; FormUser fUser = new FormUser(name, fk); fUser.ShowDialog(); ReloadTrees(true, false); if (fUser.DialogResult == DialogResult.OK) { TreeNode node = treeViewUser.Nodes.Find(fUser.NewUserName, false).First(); treeViewUser.SelectedNode = node; if (node.Nodes.Count > 0) { node.Expand(); } } } else { MessageBox.Show("Bitte Benutzer auswählen", "Achtung", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
//------------------------------------------------------------------------------------// //--------------------------------UserButtonMethods-----------------------------------// private void buttonAddUser_Click(object sender, EventArgs e) { FormUser fUser = new FormUser(string.Empty, false); fUser.ShowDialog(); ReloadTrees(true, false); if (fUser.DialogResult == DialogResult.OK) { TreeNode node = treeViewUser.Nodes.Find(fUser.NewUserName, false).First(); treeViewUser.SelectedNode = node; } }