private void DoShit(string alpha2code) { Task.Factory.StartNew(() => { FlagSource = $"https://www.countryflags.io/{alpha2code}/shiny/64.png"; Cities = new ObservableCollection <City>(LoadedCities .Where(x => x.Country == alpha2code) .OrderBy(x => x.Name)); }); }
public MainViewModel(IWebDataProvider webDataProvider) { LoadedCities = Tools.JsonDeserialize <List <City> >(@"DataSystem/city.list.json"); Countries = Tools.JsonDeserialize <ObservableCollection <CountryInfo> >(@"DataSystem/country.list.json"); SelectedCountry = Countries.FirstOrDefault(); Cities = new ObservableCollection <City>(LoadedCities .Where(x => x.Country == SelectedCountry.Alpha2Code) .OrderBy(x => x.Name)); SelectedCity = Cities.FirstOrDefault(); }