public float getCurrentWeather(string city, string countryCode)
        {
            float temperature = 0f;

            string response = getResponse(weatherBitAPIEndpoint.getCurrentWeatherEndpoint(city, countryCode));

            System.Diagnostics.Debug.WriteLine(response);

            using (JsonParser <WeatherBitAPIWeatherModel> jsonParser = new JsonParser <WeatherBitAPIWeatherModel>())
            {
                WeatherBitAPIWeatherModel weatherBitAPIWeatherModel = new WeatherBitAPIWeatherModel();
                weatherBitAPIWeatherModel = jsonParser.parse(response);

                temperature = weatherBitAPIWeatherModel.data.temp;
            }

            return(temperature);
        }
Exemplo n.º 2
0
        public float getCurrentWeather(string city)
        {
            float temperature = 0f;

            weatherBitEndAPIPoint.endpointType = EndpointType.WEATHER;

            string response = getResponse(weatherBitEndAPIPoint.getCityEndpoint(city));

            System.Diagnostics.Debug.WriteLine(response);
            using (JsonParser <WeatherBitAPIWeatherModel> jSONParser = new JsonParser <WeatherBitAPIWeatherModel>())
            {
                WeatherBitAPIWeatherModel weatherbitModel = new WeatherBitAPIWeatherModel();
                weatherbitModel = jSONParser.parse(response, netCoreVersion);

                temperature = weatherbitModel.data[0].temp;
            }

            return(temperature);
        }