Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        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(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);
 }