public static List <CountryStatisticInfo> Load(string path) { XDocument doc = XDocument.Load(path); List <CountryStatisticInfo> data = new List <CountryStatisticInfo>(); foreach (XElement countryInfo in doc.Root.Elements("CountryInfo")) { string name = countryInfo.Element("Name").Value; double areaSqKm = uint.Parse(countryInfo.Element("AreaSqrKilometers").Value); List <PopulationStatisticByYear> statistic = LoadStatistic(countryInfo.Element("Statistic")); CountryStatisticInfo countryInfoInstance = new CountryStatisticInfo(name, areaSqKm / 1000000, statistic); data.Add(countryInfoInstance); } return(data); }
public void PopulateData(string filepath) { countriesData.AddRange(CountriesInfoDataReader.Load(filepath)); selectedCountry = countriesData[0]; }