示例#1
0
 private void loadCurrentWeatherData(currentWeatherResponseObject dataCurrent)
 {
     //Current weather display values
     LocationTitle.Text = dataCurrent.name;
     weatherIcon.Load(Helpers.getIconUrl(dataCurrent.weather[0].icon));
     weatherDescription.Text       = dataCurrent.weather[0].description;
     temperatureValueDisplay.Text  = Helpers.getTemperatureDisplayValueFromString(dataCurrent.main.temp);
     temperatureMinMaxDisplay.Text = Helpers.getTemperatureDisplayValueFromString(dataCurrent.main.temp_min) + "/" + Helpers.getTemperatureDisplayValueFromString(dataCurrent.main.temp_max);
     humidityValueDisplay.Text     = Helpers.getHumidtyDisplayValueFromString(dataCurrent.main.humidity);
     windValueDisplay.Text         = Helpers.getWindDisplayValuesFromString(dataCurrent.wind.speed, dataCurrent.wind.deg);
     visibilityValueDisplay.Text   = Helpers.getVisibilityDisplayValuesFromString(dataCurrent.visibility);
 }
示例#2
0
        private void refreshWeatherData()
        {
            currentWeatherResponseObject           dataCurrent = Api.getCurrentWeatherByCity(Api.city);     //Request current weather data
            futureDailyWeatherByCityResponseObject dataDaily   = Api.getFutureDailyWeatherByCity(Api.city); //Request future weather data


            if (dataCurrent.errorMessages == null)
            {
                loadCurrentWeatherData(dataCurrent);    //Display the current weather values
                loadFutureWeatherData(dataDaily);       //Display the future weather values
            }
            else
            {
                //If error happens log into debug and let user know there is an error
                LocationTitle.Text = "ERROR";
                Debug.WriteLine(dataCurrent.errorMessages);
                Debug.WriteLine(dataDaily.errorMessages);
            }
        }