private void editUser(object sender, RoutedEventArgs e) { UserDlg udlg = new UserDlg(); udlg.Owner = this; int x = lista.SelectedIndex; udlg.Title = "Edytuj"; string a, b, c; udlg.getName = users[x].showName(); udlg.getSurname = users[x].showSurname(); udlg.getEmail = users[x].showEmail(); if (udlg.ShowDialog() == true) { a = udlg.getName; b = udlg.getSurname; c = udlg.getEmail; changeData(a, b, c, x); lista.Items.Clear(); foreach (var item in users) { lista.Items.Add(new ListBoxItem { Content = item.show() }); } } //hide(); }
private void addNewUser(object sender, RoutedEventArgs e) { UserDlg udlg = new UserDlg(); udlg.ok.IsEnabled = false; if (udlg.ShowDialog() == true) { users.Add(new User(udlg.getName, udlg.getSurname, udlg.getEmail)); lista.Items.Add(new ListBoxItem { Content = users[users.Count - 1].show() }); } }