private void AddButton_Click(object sender, RoutedEventArgs e) { var firstname = firstNameTextBox.Text; var lastname = lastNameTextBox.Text; var street = streetTextBox.Text; var city = cityTextBox.Text; var zip = zipTextBox.Text; CountryNames country = (CountryNames)countryComboBox.SelectedItem; Contact addContact = new Contact(); Address contactAddress = new Address(street, city, zip, country); try { addContact = new Contact(firstname, lastname, street, city, zip, country); } catch { addContact = new Contact(firstname, lastname, contactAddress); } finally { contactManager.AddContactToRegistry(addContact); listOfContacts.Items.Add(addContact.ToString()); } registeredCountTextBox.Text = contactManager.RegistryCount().ToString(); }