Beispiel #1
0
        public ActionResult Prognoza(string Sifra)
        {
            Prognoza Prognoza = new Prognoza();

            Prognoza.Mesta = new List <SelectListItem>();

            List <Prognoza> VremenskaPrognoza = DataLoader.LoadData();

            foreach (Prognoza P in VremenskaPrognoza)
            {
                Prognoza.Mesta.Add(new SelectListItem()
                {
                    Text = P.NazivMesta, Value = P.Sifra
                });
            }

            if (!string.IsNullOrEmpty(Sifra))
            {
                Prognoza P = VremenskaPrognoza.FirstOrDefault(m => m.Sifra.ToLower() == Sifra.ToLower());
                if (P != null)
                {
                    Prognoza.Sifra          = P.Sifra;
                    Prognoza.NazivMesta     = P.NazivMesta;
                    Prognoza.MaxTemperatura = P.MaxTemperatura;
                    Prognoza.MinTemperatura = P.MinTemperatura;
                    Prognoza.Vreme          = P.Vreme;
                }
            }

            return(View("Prognoza", Prognoza));
        }
Beispiel #2
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            RootObject myWeather = await Prognoza.GetWeather(20.0, 30.0);

            ResultTextBlock.Text = "Nalazite se u: " + myWeather.name + "\nTrenutna temperatura: " + myWeather.main.temp + " C\n\nStanje: " + myWeather.weather[0].description;
            string slika = String.Format("http://openweathermap.org/img/w/{0}.png", myWeather.weather[0].icon);

            ResultImage.Source = new BitmapImage(new Uri(slika, UriKind.Absolute));
        }