private void AddCountryButtonFinally_Click(object sender, EventArgs e) { CreateCountries(CountryNameTextBox, CountryPopulationTExtBox, InfLabel4, CountriescheckedListBox1); NameLabel.Visible = false; PopulationLabel.Visible = false; CountryPopulationTExtBox.Clear(); CountryPopulationTExtBox.Visible = false; CountryNameTextBox.Clear(); CountryNameTextBox.Visible = false; CalculateAveragePopulationFromTheList(ListOfCountries.Countries, label4, AveragePopulationLabelEveryCountriesFromList, InfLabel4); }
private void ImportButton_Click(object sender, RoutedEventArgs e) { CountryName = (System.Windows.Controls.TextBox) this.FindName("CountryNameTextBox"); CountryPath = (System.Windows.Controls.TextBox) this.FindName("CountryPathTextBox"); CountryAbbreviation = (System.Windows.Controls.TextBox) this.FindName("CountryAbbreviationTextBox"); Languages = (System.Windows.Controls.ComboBox) this.FindName("LanguageComboBox"); NextButton = (System.Windows.Controls.Button) this.FindName("NextButton"); if (ValidateForm(CountryName.Text, CountryPath.Text, CountryAbbreviation.Text)) { var selectedTag = ((ComboBoxItem)Languages.SelectedItem).Tag.ToString(); var selectedName = ((ComboBoxItem)Languages.SelectedItem).Content.ToString(); CultureInfo defaultCultureInfo = new CultureInfo(selectedTag); Guid countryId = ImportSQL.ImportCountryAndDefaultLanguage(_connectionString, new CountryLanguageModel { CountryAbbreviation = CountryAbbreviation.Text, CountryName = CountryName.Text, CountryPath = CountryPath.Text, LanguageName = selectedName, LanguageShortName = selectedName, LCID = defaultCultureInfo.LCID } ); if (countryId != null && countryId != Guid.Empty) { NextButton.IsEnabled = true; CountryIds.Add(countryId); CountryNameTextBox.Clear(); CountryPathTextBox.Clear(); CountryAbbreviationTextBox.Clear(); MessageBox.Show("Success!"); } else { MessageBox.Show("Country import was not succesfull."); } } }