/// <summary> /// Converts the weather information to their corresponding objects. /// </summary> /// <param name="JsonWeather">JObject with the required weather objects</param> /// <exception cref="ArgumentNullException">Gets thrown when the json object is null or empty Either the location is invalid or the API request failed</exception> /// <returns>returns the weather object parsed</returns> private Weather ParseJObjectToWeather(JObject JsonWeather) { if (!(JsonWeather == null || JsonWeather.Count == 0)) { Wind wind = JsonWeather["wind"].ToObject <Wind>(); MainWeather w = JsonWeather["main"].ToObject <MainWeather>(); WeatherDesc wd = JsonWeather["weather"][0].ToObject <WeatherDesc>(); return(new Weather(wind, wd, w)); } else { throw new ArgumentNullException("JsonWeather"); } }
public App() { InitializeComponent(); MainPage = new MainWeather(); }