Exemplo n.º 1
0
        public async void LoadTodaysWeatherAsync() // Runs to call and sets it into the parameter fields the response fetch from the URL through the RESThandler using the fields found from our class Response(CurrentWeather)
        {
            objRest = new RESThandler(@"http://api.openweathermap.org/data/2.5/weather?lat=" + Convert.ToDouble(tvLat.Text) + "&lon=" + Convert.ToDouble(tvLong.Text) + "&type=accurate&mode=xml&units=metric&APPID=1f324d7043102d230f6b41b4781b2cfd");
            var Response = await objRest.ExecuteRequestAsync();
            tvLocality.Text = Response.City.Name;
            string cloud = Response.Weather.Icon;
            Koush.UrlImageViewHelper.SetUrlDrawable(ivCloudIcon, "http://openweathermap.org/img/w/" + cloud + ".png");
            tvTemperature.Text = Response.Temperature.Value + "°";
            tvTempMin.Text = Response.Temperature.Min + "°";
            tvTempMax.Text = Response.Temperature.Max + "°";            
            tvHumidity.Text = Response.Humidity.Value + "%";
            tvPressure.Text = Response.Pressure.Value + "hPa";
            tvWindDirection.Text = Response.Wind.Direction.Code;
            
            string cloud1 = Response.Weather.Icon;
            Koush.UrlImageViewHelper.SetUrlDrawable(ivDay1Cloud, "http://openweathermap.org/img/w/" + cloud1 + ".png");
            tvDay1Temperature.Text = Convert.ToString(Response.Temperature.Value + "°");

        }