Exemplo n.º 1
0
        private async void GetWeatherInfo()
        {
            string url      = Content.weatherApiUrl;
            var    response = ConnectPoint.HttpGetData(Content.weatherApiUrl);
            var    result   = await response;

            if (result.Key == HttpStatusCode.OK)
            {
                OpenWeather openWeather = JsonConvert.DeserializeObject <OpenWeather>(result.Value);
                GetImageBitmapFromUrl(openWeather.weather[0].icon);
                current_weather_info.Text = openWeather.weather[0].description;
                current_city.Text         = openWeather.name;
                current_temperature.Text  = (openWeather.main.temp - 273.15) + "°C";
            }
        }
Exemplo n.º 2
0
        private async void GetWeatherInfo()
        {
            KeyValuePair <double, double> locationCoordinate = GetLocationData();
            string url = string.Format(Content.weatherApiUrlCoordinate, locationCoordinate.Key,
                                       locationCoordinate.Value);
            var response = ConnectPoint.HttpGetData(Content.weatherApiUrl);
            var result   = await response;

            if (result.Key == HttpStatusCode.OK)
            {
                OpenWeather openWeather = JsonConvert.DeserializeObject <OpenWeather>(result.Value);
                GetImageBitmapFromUrl(openWeather.weather[0].icon);
                _currentWeatherInfoTextView.Text = openWeather.weather[0].description;
                _currentCityInfoTextView.Text    = openWeather.name;
                _currentTempInfoTextView.Text    = (openWeather.main.temp - 273.15) + "°C";
            }
        }