private void EditUserButton_Click(object sender, RoutedEventArgs e) { var selected = Users.users[UserListBox.SelectedIndex]; userInputName = NameBox.Text; userInputMail = EmailBox.Text; if (selected != null) { selected.Name = userInputName; selected.Mail = userInputMail; RefreshListBoxes(); ClearTextFields(); UserListBox.UnselectAll(); } }
private void AdminListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (AdminListBox.SelectedItem != null) { UserListBox.UnselectAll(); ClearTextFields(); var selected = (AdminListBox.SelectedItem as Users); NameBox.Text = selected.Name; EmailBox.Text = selected.Mail; RemoveAdminButton.IsEnabled = true; } else { RemoveAdminButton.IsEnabled = false; } }