private void Dodaj(object sender, RoutedEventArgs e) { userDlg = new UserDlg(); Hide(); userDlg.ShowDialog(); Show(); if (userDlg.userAdded) { usersList.Items.Add(userDlg.user.getUser()); usersList.Items.Refresh(); users.Add(userDlg.user); } }
private void Edytuj(object sender, RoutedEventArgs e) { userDlg = new UserDlg(); Hide(); userDlg.userEdited = true; userDlg.openEdition(users[sel].fName, users[sel].lName, users[sel].eMail); userDlg.ShowDialog(); Show(); usersList.SelectedIndex = sel; if (userDlg.userEditDone) { users[sel].fName = userDlg.user.fName; users[sel].lName = userDlg.user.lName; users[sel].eMail = userDlg.user.eMail; usersList.Items.Insert(usersList.SelectedIndex, userDlg.user.getUser()); usersList.Items.Remove(usersList.SelectedItem); } usersList.Items.Refresh(); }