private IDateWeatherData parseToDateWeatherData(string connectionString) { using (XmlReader xmlReader = XmlReader.Create(connectionString + "&units=standard")) // sample api call = http://api.openweathermap.org/data/2.5/forecast?q=Krosno&lang=pl&APPID=29a20f74935ebf1b87a71157e2d58600&mode=xml&units=standard { xmlReader.ReadToFollowing("forecast"); DateWeatherData dateWeatherData = new DateWeatherData(); for (int i = 0; i < CountOfForecastSections3Hours5Days; i++) { DateTime forecastDateTime = DateTime.Parse( xmlReader.ParseApiData("time", "from")); IWeatherData date = ParseXMLToWeatherData(xmlReader); dateWeatherData.Add(forecastDateTime, date); } return(dateWeatherData); } }
private IDateWeatherData parseToDateWeatherData(string connectionString) { using (XmlReader xmlReader = XmlReader.Create(connectionString + "&units=standard")) // sample api call = http://api.openweathermap.org/data/2.5/forecast?q=Krosno&lang=pl&APPID=29a20f74935ebf1b87a71157e2d58600&mode=xml&units=standard { xmlReader.ReadToFollowing("forecast"); DateWeatherData dateWeatherData = new DateWeatherData(); for (int i = 0; i < CountOfForecastSections3Hours5Days; i++) { DateTime forecastDateTime = DateTime.Parse( xmlReader.ParseApiData("time", "from")); IWeatherData date = ParseXMLToWeatherData(xmlReader); dateWeatherData.Add(forecastDateTime,date); } return dateWeatherData; } }