private void UpdateButton_Click(object sender, RoutedEventArgs e) { nameInput = NameTextBox.Text.Trim(); mailInput = MailTextBox.Text.Replace(" ", ""); if (!IsNameAndMailCorrect(nameInput, mailInput, "Updating user")) { return; } if (currentUser != null) { currentUser.Name = nameInput; currentUser.Mail = mailInput; RefreshListBoxes(); ClearTextFields(); UserListBox.UnselectAll(); SetUserButtons(false); } else if (currentAdmin != null) { currentAdmin.Name = nameInput.Trim(); currentAdmin.Mail = mailInput.Replace(" ", ""); RefreshListBoxes(); ClearTextFields(); AdminListBox.UnselectAll(); SetAdminButtons(false); } }
private void UserCreationButton_Click(object sender, RoutedEventArgs e) //todo = conecta till CheckInput { NewUser(); EnterNameTextbox.Clear(); EnterEmailTextbox.Clear(); AdminListBox.UnselectAll(); UserListBox.UnselectAll(); ButtonsDisabled(); }
private void ToUserButton_Click(object sender, RoutedEventArgs e) { User.ToUser(currentAdmin); currentAdmin = null; AdminListBox.UnselectAll(); RefreshListBoxes(); ClearTextFields(); AdminListBox.UnselectAll(); SetAdminButtons(false); }
private void UserListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (UserListBox.SelectedItem != null) { AdminListBox.UnselectAll(); ClearTextFields(); SetAdminButtons(false); SetUserButtons(true); currentAdmin = null; currentUser = (UserListBox.SelectedItem as User); NameTextBox.Text = currentUser.Name; MailTextBox.Text = currentUser.Mail; MailUserLabel.Content = $"Mail: {currentUser.Mail}"; } }
private void UserListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { UserPromotionButton.IsEnabled = true; UserDeletionButton.IsEnabled = true; UsrerModificationButton.IsEnabled = true; if ((User)UserListBox.SelectedItem != null) { AdminListBox.UnselectAll(); UserInfoLabel.Content = "Username: "******"\nEmail Adress: " + ((User)UserListBox.SelectedItem).Email; } else { UserInfoLabel.Content = string.Empty; } }
private void UserListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (UserListBox.SelectedItem != null) { AdminListBox.UnselectAll(); ClearTextFields(); var selected = (UserListBox.SelectedItem as Users); NameBox.Text = selected.Name; EmailBox.Text = selected.Mail; MakeAdminButton.IsEnabled = true; EditUserButton.IsEnabled = true; DeleteUserButton.IsEnabled = true; } else { MakeAdminButton.IsEnabled = false; EditUserButton.IsEnabled = false; DeleteUserButton.IsEnabled = false; } }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { if (currentUser != null) { User.users.Remove(currentUser); currentUser = null; RefreshListBoxes(); ClearTextFields(); UserListBox.UnselectAll(); SetUserButtons(false); } else if (currentAdmin != null) { User.admins.Remove(currentAdmin); currentAdmin = null; RefreshListBoxes(); ClearTextFields(); AdminListBox.UnselectAll(); SetAdminButtons(false); } }