[chore:] usage of Country (and possible import of ISO3166-Countries)

This commit is contained in:
Elias Fierke
2026-01-02 18:02:08 +01:00
parent 7af6444da2
commit 3877d91af4
3 changed files with 65 additions and 17 deletions

View File

@@ -13,7 +13,7 @@ public partial class MainWindow : Window
public static MainWindow _instance;
private Country _selectedCountry;
private bool _suppressCountryRefresh = false;
private bool _suppressCountryRefresh;
public Uri filePath;
public MainWindow()
@@ -644,12 +644,8 @@ public partial class MainWindow : Window
if (_selectedCountry == null) return;
//Console.WriteLine("Refreshing alternatives...");
foreach (var a in _selectedCountry.alternatives)
{
LbSettingsAlternatives.Items.Add(a);
//Console.WriteLine(a);
}
foreach (var a in _selectedCountry.alternatives) LbSettingsAlternatives.Items.Add(a);
//Console.WriteLine(a);
TbSettingsCountryName.Text = _selectedCountry.name;
TbSettingsCountryTranslation.Text = _selectedCountry.translation;
@@ -719,4 +715,13 @@ public partial class MainWindow : Window
_selectedCountry = Country.GetByName(CountryList.SelectedItems[0].ToString());
RefreshCountryView();
}
private void BtnSettingsInsertDefaultCountries_OnClick(object? sender, RoutedEventArgs e)
{
ISO3166.Country[] countries = ISO3166.Country.List;
foreach (var countryie in countries)
Global._instance.countries.Add(new Country(countryie.Name, countryie.Name,
new List<string> { countryie.ThreeLetterCode, countryie.TwoLetterCode }));
RefreshCountryView();
}
}