Example #1
0
 public HeWeatherModel(WunderGroundContract wun)
 {
     if (null == wun)
     {
         return;
     }
     Status         = ParseStatus_W(wun);
     NowWeather     = new NowWeather(wun.current_observation);
     DailyForecast  = GenerateDailyForecast(wun.forecast.simpleforecast.forecastday);
     HourlyForecast = GenerateHourlyForecast(wun.hourly_forecast);
     Location       = new Location(wun.current_observation);
 }
Example #2
0
 public HeWeatherModel(HeWeatherContract heweathercontract)
 {
     if (heweathercontract == null)
     {
         throw new ArgumentException("Value can't be null.");
     }
     Status            = ParseStatus(heweathercontract.status);
     Aqi               = new AQI(heweathercontract.aqi);
     DailyForecast     = GenerateDailyForecast(heweathercontract.daily_forecast);
     HourlyForecast    = GenerateHourlyForecast(heweathercontract.hourly_forecast);
     Alarms            = GenerateWeatherAlarms(heweathercontract.alarms);
     Location          = new Location(heweathercontract.basic);
     NowWeather        = new NowWeather(heweathercontract.now);
     WeatherSuggestion = new WeatherSuggestion(heweathercontract.suggestion);
 }
Example #3
0
 public HeWeatherModel(Now now, Forecast forecast)
 {
     if (now != null)
     {
         Status = ParseStatus_C(now.status);
         if (Status == HeWeatherStatus.ok)
         {
             NowWeather = new NowWeather(now.result.temperature, now.result.skycon, now.result.precipitation, now.result.wind);
             Location   = new Location(now.location[0], now.location[1], now.server_time, now.tzshift);
         }
     }
     if (forecast != null)
     {
         if (forecast.status == "ok")
         {
             Aqi            = new AQI(forecast.result.hourly.aqi[0], forecast.result.hourly.pm25[0]);
             DailyForecast  = GenerateDailyForecast(forecast.result.daily);
             HourlyForecast = GenerateHourlyForecast(forecast.result.hourly);
         }
     }
 }
 public HeWeatherModel(WunderGroundContract wun)
 {
     if (null == wun)
     {
         return;
     }
     Status = ParseStatus_W(wun);
     NowWeather = new NowWeather(wun.current_observation);
     DailyForecast = GenerateDailyForecast(wun.forecast.simpleforecast.forecastday);
     HourlyForecast = GenerateHourlyForecast(wun.hourly_forecast);
     Location = new Location(wun.current_observation);
 }
 public HeWeatherModel(Now now, Forecast forecast)
 {
     if (now != null)
     {
         Status = ParseStatus_C(now.status);
         if (Status == HeWeatherStatus.ok)
         {
             NowWeather = new NowWeather(now.result.temperature, now.result.skycon, now.result.precipitation, now.result.wind);
             Location = new Location(now.location[0], now.location[1], now.server_time, now.tzshift);
         }
     }
     if (forecast != null)
     {
         if (forecast.status == "ok")
         {
             Aqi = new AQI(forecast.result.hourly.aqi[0], forecast.result.hourly.pm25[0]);
             DailyForecast = GenerateDailyForecast(forecast.result.daily);
             HourlyForecast = GenerateHourlyForecast(forecast.result.hourly);
         }
     }
 }
 public HeWeatherModel(HeWeatherContract heweathercontract)
 {
     if (heweathercontract == null)
         throw new ArgumentException("Value can't be null.");
     Status = ParseStatus(heweathercontract.status);
     Aqi = new AQI(heweathercontract.aqi);
     DailyForecast = GenerateDailyForecast(heweathercontract.daily_forecast);
     HourlyForecast = GenerateHourlyForecast(heweathercontract.hourly_forecast);
     Alarms = GenerateWeatherAlarms(heweathercontract.alarms);
     Location = new Location(heweathercontract.basic);
     NowWeather = new NowWeather(heweathercontract.now);
     WeatherSuggestion = new WeatherSuggestion(heweathercontract.suggestion);
 }