public WeatherLoader(double lat, double lon) { failed = false; weather_url = string.Format("http://api.openweathermap.org/data/2.5/weather?lat={0}&lon={1}&appid={2}&units=metric&cnt=6", lat, lon, APPID); forecast_url = string.Format("http://api.openweathermap.org/data/2.5/forecast?lat={0}&lon={1}&APPID={2}", lat, lon, APPID); weatherForecast = new WeatherForcast(); weatherInfo = new WeatherInfo.Root(); try { loadCurrenttWeather(); loadForecast(); } catch (Exception e) { failed = true; } }
public WeatherLoader(string city) { failed = false; try { weather_url = string.Format("http://api.openweathermap.org/data/2.5/weather?q={0}&appid={1}&units=metric&cnt=6", city, APPID); forecast_url = string.Format("http://api.openweathermap.org/data/2.5/forecast?q={0}&APPID={1}", city, APPID); weatherForecast = new WeatherForcast(); weatherInfo = new WeatherInfo.Root(); loadCurrenttWeather(); loadForecast(); } catch (Exception e) { failed = true; } }