private void ConfirmButton_Click(object sender, RoutedEventArgs e) { NewAccountDTO newAccountDTO = new NewAccountDTO(); newAccountDTO.Email = EmailTextBox.Text; newAccountDTO.Name = NameTextBox.Text; newAccountDTO.Lastname = LastnameTextBox.Text; newAccountDTO.City = CityTextBox.Text; newAccountDTO.Phone = PhoneTextBox.Text; newAccountDTO.Pid = PIDTextBox.Text; try { Client.AddAccount(newAccountDTO); } catch (Exception ex) { MessageBox.Show("Couldn't add agent"); Console.WriteLine(ex.ToString()); } parent.AgentAdded(); this.Close(); }