Exemplo n.º 1
0
        public RoadCondition GetRoadCondition(HourlyForecast forecast)
        {
            RoadCondition roadCondition;

            if (forecast.Temperature.Value <= 3)
            {
                if (forecast.SnowProbability < 20)
                {
                    roadCondition = RoadCondition.Ice;
                }
                else
                {
                    roadCondition = RoadCondition.Snow;
                }
            }
            else
            {
                if (forecast.RainProbability > 20)
                {
                    roadCondition = RoadCondition.Wet;
                }
                else
                {
                    roadCondition = RoadCondition.Dry;
                }
            }

            return(roadCondition);
        }
Exemplo n.º 2
0
        public Probabilities GetProbabilities(HourlyForecast forecast)
        {
            Probabilities probabilities;

            if (forecast.RainProbability > 40)
            {
                probabilities = Probabilities.Rain;
            }
            if (forecast.SnowProbability > 40)
            {
                probabilities = Probabilities.Snow;
            }
            if (forecast.IceProbability > 40)
            {
                probabilities = Probabilities.Ice;
            }
            if (forecast.RainProbability > 40 && 10 < forecast.RainProbability && forecast.Temperature.Value > -3 && 3 < forecast.Temperature.Value)
            {
                probabilities = Probabilities.Slippery;
            }
            else
            {
                probabilities = Probabilities.NotEvaluated;
            }
            return(probabilities);
        }
Exemplo n.º 3
0
        public void GetWeatherCondition_ReturnsCool()
        {
            HourlyForecast forecast = new HourlyForecast {
                Temperature = new UnitInfo
                {
                    Value = 2
                },
                WindGust = new WindInfo
                {
                    Speed = new UnitInfo
                    {
                        Value = 10
                    }
                },
                Wind = new WindInfo
                {
                    Speed = new UnitInfo
                    {
                        Value = 10
                    }
                },
                Rain = new UnitInfo
                {
                    Value = 15
                },
                Snow = new UnitInfo
                {
                    Value = 15
                }
            };
            var result = this.SuT.GetWeatherCondition(forecast);

            Assert.AreEqual(WeatherCondition.Cold, result);
        }
Exemplo n.º 4
0
 public void SetData(HourlyForecast forecast)
 {
     hourLabel.Text      = forecast.HourString();
     tempLabel.Text      = forecast.TempString(Settings.UomTemperature, true, true);
     precipLabel.Text    = forecast.ProbabilityPercipString();
     iconImageView.Image = UIImage.FromBundle(forecast.icon);
 }
Exemplo n.º 5
0
 public void Clear()
 {
     HourlyForecast.Clear();
     TextForecast.Clear();
     Chance = Qpf_Rain = Qpf_Snow = String.Empty;
     Alerts.Clear();
 }
Exemplo n.º 6
0
        public WeatherDataProvider()
        {
            string apiToken = "c6eMCGjH1pvf1hvI47hLVKcRrA2R41gr";
            string query    = "[{\"Version\":1,\"Key\":\"264500\",\"Type\":\"City\",\"Rank\":75,\"LocalizedName\":\"Dobczyce\",\"EnglishName\":\"Dobczyce\",\"PrimaryPostalCode\":\"\",\"Region\":{\"ID\":\"EUR\",\"LocalizedName\":\"Europe\",\"EnglishName\":\"Europe\"},\"Country\":{\"ID\":\"PL\",\"LocalizedName\":\"Poland\",\"EnglishName\":\"Poland\"},\"AdministrativeArea\":{\"ID\":\"12\",\"LocalizedName\":\"Lesser Poland\",\"EnglishName\":\"Lesser Poland\",\"Level\":1,\"LocalizedType\":\"Voivodship\",\"EnglishType\":\"Voivodship\",\"CountryID\":\"PL\"},\"TimeZone\":{\"Code\":\"CET\",\"Name\":\"Europe/Warsaw\",\"GmtOffset\":1.0,\"IsDaylightSaving\":false,\"NextOffsetChange\":\"2020-03-29T01:00:00Z\"},\"GeoPosition\":{\"Latitude\":49.88,\"Longitude\":20.09,\"Elevation\":{\"Metric\":{\"Value\":228.0,\"Unit\":\"m\",\"UnitType\":5},\"Imperial\":{\"Value\":747.0,\"Unit\":\"ft\",\"UnitType\":0}}},\"IsAlias\":false,\"SupplementalAdminAreas\":[{\"Level\":2,\"LocalizedName\":\"Myślenice\",\"EnglishName\":\"Myślenice\"},{\"Level\":3,\"LocalizedName\":\"Dobczyce\",\"EnglishName\":\"Dobczyce\"}],\"DataSets\":[\"AirQualityCurrentConditions\",\"AirQualityForecasts\",\"Alerts\",\"ForecastConfidence\",\"MinuteCast\",\"Radar\"]},{\"Version\":1,\"Key\":\"268185\",\"Type\":\"City\",\"Rank\":85,\"LocalizedName\":\"Dobczyce\",\"EnglishName\":\"Dobczyce\",\"PrimaryPostalCode\":\"\",\"Region\":{\"ID\":\"EUR\",\"LocalizedName\":\"Europe\",\"EnglishName\":\"Europe\"},\"Country\":{\"ID\":\"PL\",\"LocalizedName\":\"Poland\",\"EnglishName\":\"Poland\"},\"AdministrativeArea\":{\"ID\":\"12\",\"LocalizedName\":\"Lesser Poland\",\"EnglishName\":\"Lesser Poland\",\"Level\":1,\"LocalizedType\":\"Voivodship\",\"EnglishType\":\"Voivodship\",\"CountryID\":\"PL\"},\"TimeZone\":{\"Code\":\"CET\",\"Name\":\"Europe/Warsaw\",\"GmtOffset\":1.0,\"IsDaylightSaving\":false,\"NextOffsetChange\":\"2020-03-29T01:00:00Z\"},\"GeoPosition\":{\"Latitude\":50.055,\"Longitude\":20.87,\"Elevation\":{\"Metric\":{\"Value\":189.0,\"Unit\":\"m\",\"UnitType\":5},\"Imperial\":{\"Value\":619.0,\"Unit\":\"ft\",\"UnitType\":0}}},\"IsAlias\":false,\"ParentCity\":{\"Key\":\"1414215\",\"LocalizedName\":\"Bobrowniki Małe\",\"EnglishName\":\"Bobrowniki Małe\"},\"SupplementalAdminAreas\":[{\"Level\":2,\"LocalizedName\":\"Tarnów\",\"EnglishName\":\"Tarnów\"},{\"Level\":3,\"LocalizedName\":\"Wierzchosławice\",\"EnglishName\":\"Wierzchosławice\"}],\"DataSets\":[\"AirQualityCurrentConditions\",\"AirQualityForecasts\",\"Alerts\",\"ForecastConfidence\",\"MinuteCast\",\"Radar\"]}]";

            _citySearches = AccuWeatherLogic.getLocation(apiToken, query);

            HourlyForecastList = AccuWeatherLogic.getHourlyForecast(apiToken, _citySearches[0].Key);
            CurrentForecast    = HourlyForecastList[0];
        }
Exemplo n.º 7
0
        private void GetHourlyForecast()
        {
            var client  = new RestClient("http://dataservice.accuweather.com/forecasts/v1/hourly/1hour/" + locationCode + "?apikey=SyQbb4hIuNveRnj4NLzAWrRWBPMyv53q&details=true&metric=false");
            var request = new RestRequest(Method.GET);

            request.AddHeader("Postman-Token", "23acb8fb-c16a-4064-b29c-7d55d782675e");
            request.AddHeader("Cache-Control", "no-cache");
            IRestResponse response = client.Execute(request);

            hourlyForecast = new HourlyForecast(response.Content.ToString());
        }
Exemplo n.º 8
0
        public void UpdateView(Weather weather)
        {
#if WINDOWS_UWP
            var userlang = Windows.System.UserProfile.GlobalizationPreferences.Languages[0];
            var culture  = new System.Globalization.CultureInfo(userlang);
#else
            var culture = System.Globalization.CultureInfo.CurrentCulture;
#endif

            // Clear all data
            Clear();

            if (weather.hr_forecast != null && weather.hr_forecast.Length > 0)
            {
                foreach (HourlyForecast hr_forecast in weather.hr_forecast)
                {
                    HourlyForecastItemViewModel hrforecastView = new HourlyForecastItemViewModel(hr_forecast);
                    HourlyForecast.Add(hrforecastView);
                }
            }

            if (weather.txt_forecast != null && weather.txt_forecast.Length > 0)
            {
                foreach (TextForecast txt_forecast in weather.txt_forecast)
                {
                    TextForecastItemViewModel txtforecastView = new TextForecastItemViewModel(txt_forecast);
                    TextForecast.Add(txtforecastView);
                }
            }

            if (weather.precipitation != null)
            {
                Chance   = weather.precipitation.pop + "%";
                Qpf_Rain = Settings.IsFahrenheit ?
                           weather.precipitation.qpf_rain_in.ToString("0.00", culture) + " in" : weather.precipitation.qpf_rain_mm.ToString(culture) + " mm";
                Qpf_Snow = Settings.IsFahrenheit ?
                           weather.precipitation.qpf_snow_in.ToString("0.00", culture) + " in" : weather.precipitation.qpf_snow_cm.ToString(culture) + " cm";
            }

            if (weather.weather_alerts != null && weather.weather_alerts.Count > 0)
            {
                foreach (WeatherAlert alert in weather.weather_alerts)
                {
                    // Skip if alert has expired
                    if (alert.ExpiresDate <= DateTimeOffset.Now)
                    {
                        continue;
                    }

                    WeatherAlertViewModel alertView = new WeatherAlertViewModel(alert);
                    Alerts.Add(alertView);
                }
            }
        }
        private List <WeatherAlarmType> GetWeatherAlarms(HourlyForecast hourlyForecast)
        {
            this.GetWeatherAlarmThresholdValues();
            List <WeatherAlarmType> weatherAlarmTypes = new List <WeatherAlarmType>();
            Double?numericValue = hourlyForecast.Ice.NumericValue;
            Double num          = this._weatherAlarmThresholdIce;

            if (((Double)numericValue.GetValueOrDefault() <= num ? false : numericValue.HasValue))
            {
                weatherAlarmTypes.Add(WeatherAlarmType.Ice);
            }
            Double?nullable = hourlyForecast.Rain.NumericValue;
            Double num1     = this._weatherAlarmThresholdRain;

            if (((Double)nullable.GetValueOrDefault() <= num1 ? false : nullable.HasValue))
            {
                weatherAlarmTypes.Add(WeatherAlarmType.Rain);
            }
            Double?numericValue1 = hourlyForecast.Snow.NumericValue;
            Double num2          = this._weatherAlarmThresholdSnow;

            if (((Double)numericValue1.GetValueOrDefault() <= num2 ? false : numericValue1.HasValue))
            {
                weatherAlarmTypes.Add(WeatherAlarmType.Snow);
            }
            Int32?thunderstormProbability = hourlyForecast.ThunderstormProbability;
            Int32 num3 = this._weatherAlarmThresholdThunderstorm;

            if ((thunderstormProbability.GetValueOrDefault() <= num3 ? false : thunderstormProbability.HasValue))
            {
                weatherAlarmTypes.Add(WeatherAlarmType.Thunderstorm);
            }

            /*
             * Double? nullable1 = hourlyForecast.Wind.Speed.Metric.NumericValue;
             * Double num4 = this._weatherAlarmThresholdWindSpeed;
             * if (((Double)nullable1.GetValueOrDefault() <= num4 ? false : nullable1.HasValue))
             * {
             *  weatherAlarmTypes.Add(WeatherAlarmType.WindSpeed);
             * }
             * Double? numericValue2 = hourlyForecast.WindGust.Speed.Metric.NumericValue;
             * Double num5 = this._weatherAlarmThresholdWindGusts;
             * if (((Double)numericValue2.GetValueOrDefault() <= num5 ? false : numericValue2.HasValue))
             * {
             *  weatherAlarmTypes.Add(WeatherAlarmType.WindGust);
             * }
             */
            return(weatherAlarmTypes);
        }
Exemplo n.º 10
0
        public WeatherCondition GetWeatherCondition(HourlyForecast forecast)
        {
            WeatherCondition weather;

            if (forecast.Rain.Value >= 20)
            {
                weather = WeatherCondition.Rain;
            }
            else
            {
                weather = WeatherCondition.None;
            }

            if (forecast.Snow.Value >= 20)
            {
                weather = WeatherCondition.Snow;
            }
            else
            {
                weather = WeatherCondition.NoSnow;
            }

            if (forecast.Temperature.Value < -10)
            {
                weather = WeatherCondition.Freezing;
            }

            if (forecast.Temperature.Value >= -10 && 8 >= forecast.Temperature.Value)
            {
                weather = WeatherCondition.Cold;
            }
            else if (forecast.Temperature.Value > 8 && 14 > forecast.Temperature.Value)
            {
                weather = WeatherCondition.Cool;
            }
            else
            {
                weather = WeatherCondition.Warm;
            }

            return(weather);
        }
Exemplo n.º 11
0
        public PrecipitationCondition GetPrecipitation(HourlyForecast forecast)
        {
            PrecipitationCondition precipitation;

            if (forecast.PreciptationProbability > 40)
            {
                if (forecast.RainProbability > forecast.SnowProbability)
                {
                    precipitation = PrecipitationCondition.Rain;
                }
                else
                {
                    precipitation = PrecipitationCondition.Snow;
                }
            }
            else
            {
                precipitation = PrecipitationCondition.None;
            }
            return(precipitation);
        }
        public HourlyForecastItemViewModel(HourlyForecast hr_forecast)
        {
            wm = WeatherManager.GetInstance();

#if WINDOWS_UWP
            var userlang = Windows.System.UserProfile.GlobalizationPreferences.Languages[0];
            var culture  = new CultureInfo(userlang);
#else
            var culture = CultureInfo.CurrentCulture;
#endif
            WeatherIcon = hr_forecast.icon;

#if WINDOWS_UWP
            if (culture.DateTimeFormat.ShortTimePattern.Contains("H"))
            {
                Date = hr_forecast.date.ToString("ddd HH:00", culture);
            }
            else
            {
                Date = hr_forecast.date.ToString("ddd h tt", culture);
            }
#elif __ANDROID__
            if (Android.Text.Format.DateFormat.Is24HourFormat(Application.Context))
            {
                Date = hr_forecast.date.ToString("ddd HH:00");
            }
            else
            {
                Date = hr_forecast.date.ToString("ddd h tt");
            }
#endif
            Condition = hr_forecast.condition;
            HiTemp    = (Settings.IsFahrenheit ?
                         Math.Round(double.Parse(hr_forecast.high_f)).ToString() : Math.Round(double.Parse(hr_forecast.high_c)).ToString()) + "º ";
            PoP = hr_forecast.pop + "%";
            UpdateWindDirection(hr_forecast.wind_degrees);
            WindSpeed = (Settings.IsFahrenheit ?
                         Math.Round(hr_forecast.wind_mph) + " mph" : Math.Round(hr_forecast.wind_kph) + " kph");
        }
Exemplo n.º 13
0
        public WindCondition GetWindCondition(HourlyForecast forecast)
        {
            WindCondition windCondition;

            if (forecast.WindGust.Speed.Value >= 25 && forecast.Wind.Speed.Value >= 20)
            {
                windCondition = WindCondition.StrongWinds;
            }
            else
            {
                if (forecast.WindGust.Speed.Value >= 10 && 24 >= forecast.WindGust.Speed.Value ||
                    forecast.Wind.Speed.Value >= 10 && 24 >= forecast.Wind.Speed.Value)
                {
                    windCondition = WindCondition.LightWinds;
                }
                else
                {
                    windCondition = WindCondition.Calm;
                }
            }

            return(windCondition);
        }
Exemplo n.º 14
0
 public static string HourString(this HourlyForecast forecast, bool lowercase = true, bool removePeriod = true)
 => removePeriod?forecast.FCTTIME.civil.SplitOnFirst(' ').FirstOrDefault() : lowercase?forecast.FCTTIME.ampm.ToLower() : forecast.FCTTIME.civil;
Exemplo n.º 15
0
        /// <summary>
        /// Adds a day panel into the forecast grid
        /// </summary>
        /// <param name="day"></param>
        /// <param name="col"></param>
        private void AddHourPanel(HourlyForecast hour, int col)
        {
            //Get day name from epoch time
            System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
            dtDateTime = dtDateTime.AddSeconds(hour.EpochDateTime).ToLocalTime();
            //Create day name
            TextBlock tbn = new TextBlock
            {
                Text = dtDateTime.Day + "/" + dtDateTime.Hour + ":00",
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                FontSize            = 20,
                Foreground          = new SolidColorBrush(Colors.White),
                FontWeight          = FontWeights.Bold
            };

            grdForecastHours.Children.Add(tbn);
            Grid.SetColumn(tbn, col);
            Grid.SetRow(tbn, 0);

            //Weather Picture
            Image img = new Image
            {
                Source = new BitmapImage(new System.Uri("ms-appx:///Assets/icons/" + hour.WeatherIcon + ".png")),
                Width  = 60,
                Height = 60
            };

            grdForecastHours.Children.Add(img);
            Grid.SetColumn(img, col);
            Grid.SetRow(img, 1);
            //Night
            TextBlock tbni = new TextBlock
            {
                Text = hour.IconPhrase,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                FontSize            = 15,
                Foreground          = new SolidColorBrush(Colors.White),
                FontWeight          = FontWeights.Bold
            };

            grdForecastHours.Children.Add(tbni);
            Grid.SetColumn(tbni, col);
            Grid.SetRow(tbni, 2);


            //Add temperature
            TextBlock tbt = new TextBlock
            {
                Text = Math.Round(hour.Temperature.Value) + "°C",
                HorizontalAlignment = HorizontalAlignment.Center,
                FontSize            = 25,
                Foreground          = new SolidColorBrush(Colors.White),
                FontWeight          = FontWeights.Bold
            };

            grdForecastHours.Children.Add(tbt);
            Grid.SetColumn(tbt, col);
            Grid.SetRow(tbt, 3);
        }
Exemplo n.º 16
0
        public Others GetOthers(HourlyForecast forecast)
        {
            Others others;

            if (forecast.RealFeelTemperature.Value >= 15 &&
                forecast.IsDaylight == true &&
                forecast.Visibility.Value > 8 &&
                forecast.PreciptationProbability < 30 &&
                forecast.Wind.Speed.Value < 9 &&
                forecast.WindGust.Speed.Value < 9)
            {
                others = Others.ADayAtThePark;
            }
            else
            {
                others = Others.NotEvaluated;
            }

            if (forecast.Rain.Value > 10 &&
                forecast.Temperature.Value > -3 && 3 < forecast.Temperature.Value &&
                forecast.Visibility.Value < 5)
            {
                others = Others.SlipperyForDriving;
            }
            else
            {
                others = Others.NotEvaluated;
            }

            if (forecast.Snow.Value > 10 &&
                forecast.Temperature.Value == 0 &&
                forecast.Wind.Speed.Value > 15 &&
                forecast.Wind.Speed.Value > 15 &&
                forecast.Visibility.Value < 5)
            {
                others = Others.PoorDrivingConditions;
            }
            else
            {
                others = Others.NotEvaluated;
            }

            if (forecast.Temperature.Value < -10 ||
                forecast.Snow.Value > 10 &&
                forecast.Temperature.Value < -10)
            {
                others = Others.PreferableToDrive;
            }
            else
            {
                others = Others.NotEvaluated;
            }

            if (forecast.Temperature.Value > -6 && -1 > forecast.Temperature.Value && // check if the preceipitation is snow and if the snow level is betweem 1 and 6
                forecast.Snow.Value > 1 && 6 < forecast.Snow.Value)
            {
                others = Others.GoodForSki;
            }
            else
            {
                others = Others.NotEvaluated;
            }
            return(others);
        }
Exemplo n.º 17
0
        static TileNotification CreateTileHourly(HourlyForecast hourlyForecast)
        {
            var content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = GetMediumVisual(),
                    TileWide   = GetWideVisual(),
                    TileLarge  = GetLargeVisual()
                }
            };

            TileBinding GetMediumVisual()
            {
                return(new TileBinding()
                {
                    Content = new TileBindingContentAdaptive()
                    {
                        Children =
                        {
                            new AdaptiveGroup()
                            {
                                Children =
                                {
                                    CreateHourlySubGroup(hourlyForecast.Hours[1]),
                                    CreateHourlySubGroup(hourlyForecast.Hours[2])
                                }
                            }
                        }
                    }
                });
            }

            TileBinding GetWideVisual()
            {
                return(new TileBinding()
                {
                    Content = new TileBindingContentAdaptive()
                    {
                        Children =
                        {
                            new AdaptiveGroup()
                            {
                                Children =
                                {
                                    CreateHourlySubGroup(hourlyForecast.Hours[1]),
                                    CreateHourlySubGroup(hourlyForecast.Hours[2]),
                                    CreateHourlySubGroup(hourlyForecast.Hours[3]),
                                    CreateHourlySubGroup(hourlyForecast.Hours[4]),
                                    CreateHourlySubGroup(hourlyForecast.Hours[5]),
                                }
                            }
                        }
                    }
                });
            }

            TileBinding GetLargeVisual()
            {
                return(new TileBinding()
                {
                    Content = new TileBindingContentAdaptive()
                    {
                        TextStacking = TileTextStacking.Center,
                        Children =
                        {
                            new AdaptiveGroup()
                            {
                                Children =
                                {
                                    CreateHourlySubGroup(hourlyForecast.Hours[1]),
                                    CreateHourlySubGroup(hourlyForecast.Hours[2]),
                                    CreateHourlySubGroup(hourlyForecast.Hours[3]),
                                    CreateHourlySubGroup(hourlyForecast.Hours[4]),
                                    CreateHourlySubGroup(hourlyForecast.Hours[5]),
                                }
                            },
                            new AdaptiveText(), // for spacing
                            new AdaptiveGroup()
                            {
                                Children =
                                {
                                    CreateHourlySubGroup(hourlyForecast.Hours[6]),
                                    CreateHourlySubGroup(hourlyForecast.Hours[7]),
                                    CreateHourlySubGroup(hourlyForecast.Hours[8]),
                                    CreateHourlySubGroup(hourlyForecast.Hours[9]),
                                    CreateHourlySubGroup(hourlyForecast.Hours[10]),
                                }
                            }
                        }
                    }
                });
            }

            return(new TileNotification(content.GetXml()));
        }
Exemplo n.º 18
0
 public static string ProbabilityPercipString(this HourlyForecast forecast) => (forecast?.pop ?? 0).ToPercentString();
Exemplo n.º 19
0
 public static string PeriodString(this HourlyForecast forecast, bool lowercase = true)
 => !forecast.FCTTIME.ampm.IsNullOrEmpty() ? (lowercase ? forecast.FCTTIME.ampm.ToLower() : forecast.FCTTIME.ampm) : forecast.HourString(lowercase, false).SplitOnLast(' ').LastOrDefault();
Exemplo n.º 20
0
 public static string HourString(this HourlyForecast forecast, bool lowercase = true)
 => lowercase?forecast.FCTTIME.civil.ToLower() : forecast.FCTTIME.civil;
Exemplo n.º 21
0
 public static string TempString(this HourlyForecast forecast, TemperatureUnits units, bool round = false, bool degreeSymbol = false)
 => getTemperatureString(forecast.Temp(units, round), degreeSymbol);
Exemplo n.º 22
0
 public static double Temp(this HourlyForecast forecast, TemperatureUnits units, bool round = false)
 => getValueInUnits(units, forecast?.temp?.english, forecast?.temp?.metric, round);
Exemplo n.º 23
0
        public ObservableCollection <DailyForecast> GetForecasts(string city)
        {
            string    resultApi;
            WebClient client = new WebClient();

            try
            {
                resultApi = client.DownloadString($"{webApiF}{city}&appid={token}");

                ForecastsInfo result = JsonConvert.DeserializeObject <ForecastsInfo>(resultApi);

                ForecastsInfo root = result;

                ObservableCollection <DailyForecast> df = new ObservableCollection <DailyForecast>();

                string  aDaysUV = client.DownloadString($"{webApiUVI}{token}&lat={root.city.coord.lat.ToString().Replace(',', '.')}&lon={root.city.coord.lon.ToString().Replace(',', '.')}&cnt=5");
                dynamic uvJson  = JsonConvert.DeserializeObject(aDaysUV);

                IEnumerable <ForecastsInfo.list> lists;

                int i = 0; //UVIndexCNTr
                for (DateTime day = DateTime.Now; ; day = day.AddDays(1))
                {
                    if (day.Day <= 9)
                    {
                        lists = from l in root.List where l.dt_txt.Split('-').Last().Split(' ').First() == ("0" + day.Day.ToString()) select l;
                    }
                    else
                    {
                        lists = from l in root.List where l.dt_txt.Split('-').Last().Split(' ').First() == day.Day.ToString() select l;
                    }

                    if (lists.Count() != 0)
                    {
                        DailyForecast d = new DailyForecast
                        {
                            deg      = Convert.ToInt32(lists.First().wind.deg),
                            wind     = Convert.ToInt32(lists.First().wind.speed),
                            humidity = Convert.ToInt32(lists.First().main.humidity),
                            Day      = day.DayOfWeek.ToString() + " " + day.Day.ToString(),
                            descr    = lists.First().Weather[0].description.Substring(0, 1).ToUpper() + lists.First().Weather[0].description.Remove(0, 1),
                            icon     = "/Images/WeatherStatuss/" + lists.First().Weather[0].icon + ".png"
                        };

                        #region Get UVIndex
                        if (day.ToShortDateString() == DateTime.Now.ToShortDateString())
                        {
                            string  todayuv = client.DownloadString($"http://api.openweathermap.org/data/2.5/uvi?appid={token}&lat={root.city.coord.lat.ToString().Replace(',', '.')}&lon={root.city.coord.lon.ToString().Replace(',', '.')}");
                            dynamic uv1json = JsonConvert.DeserializeObject(todayuv);
                            d.uvindex = uvJson[0]["value"];
                        }
                        else
                        {
                            d.uvindex = uvJson[i]["value"];
                        }
                        i++;
                        #endregion

                        foreach (ForecastsInfo.list list in lists)
                        {
                            HourlyForecast h = new HourlyForecast
                            {
                                time     = list.dt_txt.Split(' ').Last(),
                                temp     = Convert.ToInt32(WeatherConvertor.KelvinToCelsius(list.main.temp)),
                                wind     = Convert.ToInt32(WeatherConvertor.MsToKh(list.wind.speed)),
                                deg      = Convert.ToInt32(list.wind.deg),
                                icon     = "/Images/WeatherStatuss/" + list.Weather[0].icon + ".png",
                                descr    = list.Weather[0].description.Substring(0, 1).ToUpper() + list.Weather[0].description.Remove(0, 1),
                                humidity = Convert.ToInt32(list.main.humidity)
                            };

                            d.Hourlies.Add(h);
                        }

                        #region Get min/max
                        d.temp_max = d.Hourlies.OrderBy(x => x.temp).Last().temp;
                        d.temp_min = d.Hourlies.OrderBy(x => x.temp).First().temp;
                        #endregion

                        df.Add(d);
                    }
                    else if (lists.Count() == 0)
                    {
                        break;
                    }
                }


                return(df);
            }
            catch { throw; }
        }