private void FixData()
        {
            MyWeather mojObjekat = new MyWeather();

            weather.myList = new List <MyWeather>();

            mojObjekat.date          = weather.list[0].dt_txt.Substring(0, 10);
            mojObjekat.min_temp      = weather.list[0].main.temp_max;
            mojObjekat.max_temp      = weather.list[0].main.temp_max;
            mojObjekat.description   = weather.list[0].weather[0].description;
            mojObjekat.id            = weather.list[0].weather[0].id;
            mojObjekat.icon          = @"./res/icons/" + Weather.list[0].weather[0].icon + ".png";
            mojObjekat.original_date = weather.list[0].dt_txt.Substring(0, 10);

            for (int i = 0; i < weather.list.Count(); i++)
            {
                Weather.list[i].weather[0].icon = @"./res/icons/" + Weather.list[i].weather[0].icon + ".png";

                if (weather.list[i].dt_txt.Contains(mojObjekat.date))
                {
                    if (weather.list[i].main.temp_min < mojObjekat.min_temp)
                    {
                        mojObjekat.min_temp = weather.list[i].main.temp_min;
                    }

                    if (weather.list[i].main.temp_max > mojObjekat.max_temp)
                    {
                        mojObjekat.max_temp = weather.list[i].main.temp_max;
                    }
                }

                else
                {
                    mojObjekat.date = mojObjekat.date.Substring(8, 2) + "." + mojObjekat.date.Substring(5, 2) + "." + mojObjekat.date.Substring(0, 4) + ".";
                    weather.myList.Add(mojObjekat);
                    mojObjekat = new MyWeather();

                    mojObjekat.original_date = weather.list[i].dt_txt.Substring(0, 10);
                    mojObjekat.date          = weather.list[i].dt_txt.Substring(0, 10);
                    mojObjekat.min_temp      = weather.list[i].main.temp_min;
                    mojObjekat.max_temp      = weather.list[i].main.temp_max;
                    mojObjekat.description   = weather.list[i].weather[0].description;
                    mojObjekat.id            = weather.list[i].weather[0].id;
                    mojObjekat.icon          = weather.list[i].weather[0].icon;
                }
            }

            if (weather.myList.Count() < 5)
            {
                weather.myList.Add(mojObjekat);
            }

            OnPropertyChanged("Weather");
        }
示例#2
0
        public DetailedView(ForecastManager forecastManager, MyWeather myWeather)
        {
            InitializeComponent();
            this.forecastManager = forecastManager;
            this.myWeather       = myWeather;
            this.DataContext     = this;

            InitializeWeather();
            showColumnChart();

            this.Owner = App.Current.MainWindow;
        }