public void Admins_SelectionChanged(object sender, SelectionChangedEventArgs e) { Namn.Clear(); Mail.Clear(); adminSelected = true; userSelected = false; if (Admins.SelectedIndex > -1) { var admin = admins[Admins.SelectedIndex]; Namn.Text = admin.Name; Mail.Text = admin.Mail; RemoveUser.IsEnabled = true; ChangeUser.IsEnabled = true; AddUser.IsEnabled = false; } }
public void Users_SelectionChanged(object sender, SelectionChangedEventArgs e) { Namn.Clear(); Mail.Clear(); userSelected = true; adminSelected = false; if (Users.SelectedIndex > -1) { var user = users[Users.SelectedIndex]; Namn.Text = user.Name; Mail.Text = user.Mail; RemoveUser.IsEnabled = true; ChangeUser.IsEnabled = true; AddUser.IsEnabled = false; } }
private void AddUser_Click(object sender, RoutedEventArgs e) { if (AddUser.IsEnabled == true) { if (Namn.Text == "" || Mail.Text == "") { } else { users.Add(new User() { Name = Namn.Text, Mail = Mail.Text }); Namn.Clear(); Mail.Clear(); AddUser.IsEnabled = false; } } }