Ejemplo n.º 1
0
        private WeatherInfo cityWeatherInfo(string city)
        {
            string fullUrl = urlGetCity + city;

            string weather = new WebClient().DownloadString(fullUrl);

            APIWeather weatherObj = JsonConvert.DeserializeObject <APIWeather>(weather);

            // Return result to client
            return(new WeatherInfo
            {
                city = weatherObj.location.name,
                tmp = weatherObj.current.temp,
                wind = weatherObj.current.wind,
                feelLike = weatherObj.current.feelslike
            });
        }
Ejemplo n.º 2
0
        private async void PreencheTela(string id)
        {
            data = await APIWeather.TestAsync(id);

            TextView cidade = FindViewById <TextView>(Resource.Id.cidade);

            cidade.Text = data.Name;
            TextView temperatura = FindViewById <TextView>(Resource.Id.temperatura);

            temperatura.Text = data.Main.Temp;
            TextView tempMax = FindViewById <TextView>(Resource.Id.tempMax);

            tempMax.Text = data.Main.TempMax;
            TextView tempMin = FindViewById <TextView>(Resource.Id.tempMin);

            tempMin.Text = data.Main.TempMin;
            TextView desc = FindViewById <TextView>(Resource.Id.desc);

            desc.Text = data.Weather[0].Description;
        }