public NowWeather(double temp, string con, PcpnTotal pcpn, WindTotal wind) { Now = new NowCondition(con); BodyTemprature = null; Precipitation = (float)pcpn.local.intensity; Wind = new Wind(wind); Pressure = null; Temprature = Temperature.FromCelsius((float)temp); }
public HourlyForecast(hourly hour) { CultureInfo provider = CultureInfo.InvariantCulture; var t = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); DateTime = new DateTime(int.Parse(hour.FCTTIME.year), int.Parse(hour.FCTTIME.mon), int.Parse(hour.FCTTIME.mday), int.Parse(hour.FCTTIME.hour), int.Parse(hour.FCTTIME.min), int.Parse(hour.FCTTIME.sec)); Humidity = Convert.ToUInt32(float.Parse(hour.humidity, provider)); Pop = Convert.ToUInt32(float.Parse(hour.pop)); Temprature = Temperature.FromCelsius(float.Parse(hour.temp.metric, provider)); Wind = new Wind(Convert.ToUInt32(float.Parse(hour.wspd.metric, provider)), Convert.ToUInt32(float.Parse(hour.wdir.degrees))); }
public HourlyForecast(Value temp, Value pcpn, Value hum, Core.Models.Caiyun.JsonContract.Wind wind) { CultureInfo provider = CultureInfo.InvariantCulture; DateTime = DateTime.ParseExact(temp.datetime, "yyyy-MM-dd HH:mm", provider); Temprature = Temperature.FromCelsius((float)temp.value); Wind = new Wind(wind); Humidity = (uint)(hum.value * 100); var p = (uint)(pcpn.value / 6.0 * 100); if (p > 100) { p = 100; } Pop = p; }
public HourlyForecast(JsonContract.HourlyForecastContract hourly_forecast) { if (hourly_forecast == null) { return; } CultureInfo provider = CultureInfo.InvariantCulture; DateTime = DateTime.ParseExact(hourly_forecast.date, "yyyy-MM-dd HH:mm", provider); Humidity = uint.Parse(hourly_forecast.hum); Pop = uint.Parse(hourly_forecast.pop); Pressure = Pressure.FromHPa(float.Parse(hourly_forecast.pres, provider)); Temprature = Temperature.FromCelsius(int.Parse(hourly_forecast.tmp)); Wind = new Wind(hourly_forecast.wind); }
public NowWeather(JsonContract.NowWeatherContract now) { if (now == null) { return; } CultureInfo provider = CultureInfo.InvariantCulture; Now = new NowCondition(now.cond); int fl; if (int.TryParse(now.fl, NumberStyles.Any, provider, out fl)) BodyTemprature = Temperature.FromCelsius(fl); float pcpn; if (float.TryParse(now.pcpn, NumberStyles.Any, provider, out pcpn)) Precipitation = pcpn; if (float.TryParse(now.vis, NumberStyles.Any, provider, out pcpn)) Visibility = Length.FromKM(pcpn); Wind = new Wind(now.wind); if (float.TryParse(now.pres, NumberStyles.Any, provider, out pcpn)) Pressure = Pressure.FromHPa(pcpn); if (int.TryParse(now.tmp, NumberStyles.Any, provider, out fl)) Temprature = Temperature.FromCelsius(fl); }
public DailyForecast(JsonContract.DailyForecastContract daily_forecast) { if (daily_forecast == null) { return; } CultureInfo provider = CultureInfo.InvariantCulture; Date = DateTime.ParseExact(daily_forecast.date, "yyyy-MM-dd", provider); SunRise = TimeSpan.Parse(daily_forecast.astro.sr); SunSet = TimeSpan.Parse(daily_forecast.astro.ss); Condition = new DailyCondition(daily_forecast.cond); Humidity = uint.Parse(daily_forecast.hum); Precipitation = float.Parse(daily_forecast.pcpn, provider); Pop = uint.Parse(daily_forecast.pop); Pressure = Pressure.FromHPa(float.Parse(daily_forecast.pres, provider)); HighTemp = Temperature.FromCelsius(int.Parse(daily_forecast.tmp.max)); LowTemp = Temperature.FromCelsius(int.Parse(daily_forecast.tmp.min)); Visibility = Length.FromKM(float.Parse(daily_forecast.vis, provider)); Wind = new Wind(daily_forecast.wind); }
public DailyForecast(forecastday daily) { Date = new DateTime(daily.date.year, daily.date.month, daily.date.day); Condition = new DailyCondition(daily.icon); float m; CultureInfo provider = CultureInfo.InvariantCulture; if (float.TryParse(daily.high.celsius, NumberStyles.Any, provider, out m)) { HighTemp = Temperature.FromCelsius(m); } if (float.TryParse(daily.low.celsius, NumberStyles.Any, provider, out m)) { LowTemp = Temperature.FromCelsius(m); } Humidity = Convert.ToUInt32(daily.avehumidity); Precipitation = Convert.ToSingle(daily.qpf_allday.mm); Wind = new Wind(Convert.ToUInt32(daily.avewind.kph), Convert.ToUInt32(daily.avewind.degrees)); }
public DailyForecast(Skycon skycon, Range temperature, Range humidity, Range precipitation, RangeWind wind, Astro astro) { CultureInfo provider = CultureInfo.InvariantCulture; Date = DateTime.ParseExact(temperature.date, "yyyy-MM-dd", provider); SunRise = TimeSpan.Parse(astro.sunrise.time); SunSet = TimeSpan.Parse(astro.sunset.time); Condition = new DailyCondition(skycon); HighTemp = Temperature.FromCelsius((float)temperature.max); LowTemp = Temperature.FromCelsius((float)temperature.min); Humidity = (uint)(humidity.avg * 100); Precipitation = (uint)precipitation.avg; Wind = new Wind(wind.avg); }
public NowWeather(observation current_observation) { if (current_observation == null) { return; } Now = new NowCondition(current_observation); CultureInfo provider = CultureInfo.InvariantCulture; float i; Temprature = Temperature.FromCelsius(current_observation.temp_c); if (float.TryParse(current_observation.feelslike_c, NumberStyles.Any, provider, out i)) { BodyTemprature = Temperature.FromCelsius(i); } if (float.TryParse(current_observation.precip_today_metric, NumberStyles.Any, provider, out i)) { Precipitation = i; } if (float.TryParse(current_observation.visibility_km, NumberStyles.Any, provider, out i)) { Visibility = Length.FromKM(i); } Wind = new Wind(Convert.ToUInt32(current_observation.wind_kph), Convert.ToUInt32(current_observation.wind_degrees)); if (float.TryParse(current_observation.pressure_mb, NumberStyles.Any, provider, out i)) { Pressure = Pressure.FromHPa(i); } }