private void UserCreationButton_Click(object sender, RoutedEventArgs e) //todo = conecta till CheckInput { NewUser(); EnterNameTextbox.Clear(); EnterEmailTextbox.Clear(); AdminListBox.UnselectAll(); UserListBox.UnselectAll(); ButtonsDisabled(); }
private void UpdateButton_Click(object sender, RoutedEventArgs e) { NewUser(); if (((User)UserListBox.SelectedItem != null)) { ((User)UserListBox.SelectedItem).UserName = EnterNameTextbox.Text; ((User)UserListBox.SelectedItem).Email = EnterEmailTextbox.Text; UserListBox.Items.Remove(UserListBox.SelectedItem); } else if (((User)AdminListBox.SelectedItem != null)) { ((User)AdminListBox.SelectedItem).UserName = EnterNameTextbox.Text; ((User)AdminListBox.SelectedItem).Email = EnterEmailTextbox.Text; AdminListBox.Items.Remove(AdminListBox.SelectedItem); } ButtonsDisabled(); UpdateButton.IsEnabled = false; UserCreationButton.IsEnabled = true; UserListBox.IsEnabled = true; AdminListBox.IsEnabled = true; EnterNameTextbox.Clear(); EnterEmailTextbox.Clear(); }