Exemplo n.º 1
0
        private void setForecasteWeatherData(string cityName)
        {
            List <ForecastWeather> forecastWeatherList = ApiUtilities.getForecastWeatherByCityName(cityName);

            //ListView ListView = new ListView();

            //foreach (ForecastWeather forecastWeatherElement in forecastWeatherList)
            for (int i = 0; i < forecastWeatherList.Count; i++)
            {
                ForecastWeather forecastWeatherElement = forecastWeatherList[i];

                Console.WriteLine("test : {0}", forecastWeatherElement.DateText);

                DataGridViewRow row = (DataGridViewRow)dataGridView1.Rows[i].Clone();

                //row.Cells["ColumnDateText"].Value = forecastWeatherElement.DateText;
                row.Cells[0].Value = DisplayTextDataUtility.displayDateText(forecastWeatherElement.DateText);
                row.Cells[1].Value = DisplayTextDataUtility.displayTemp(forecastWeatherElement.Temp, true);
                //row.Cells[2].Value = DisplayTextDataUtility.displayFeelsLike(ApiUtilities.convertKelvenToCelcius(forecastWeatherElement.FeelsLike));
                row.Cells[2].Value = DisplayTextDataUtility.displayFeelsLike(forecastWeatherElement.FeelsLike, true);
                row.Cells[3].Value = DisplayTextDataUtility.displayhumidity(forecastWeatherElement.Humidity, true);
                row.Cells[4].Value = DisplayTextDataUtility.displayPressure(forecastWeatherElement.Pressure, true);
                row.Cells[5].Value = DisplayTextDataUtility.displaywind(forecastWeatherElement.WindSpeed, forecastWeatherElement.WindDirection, true);
                row.Cells[6].Value = DisplayTextDataUtility.displayCloudCover(forecastWeatherElement.CloudCover, true);

                dataGridView1.Rows.Add(row);
            }
        }
Exemplo n.º 2
0
        private void setCurrentWeatherData(string cityName)
        {
            CurrentWeather currentWeather = ApiUtilities.getCurrentWeatherByCityName(cityName);

            labelDateTime.Text = DisplayTextDataUtility.displayCurrentDateText();
            cityLable.Text     = DisplayTextDataUtility.displayCity(currentWeather.CityName, currentWeather.Country);
            //tempLabel.Text = DisplayTextDataUtility.displayTemp(ApiUtilities.convertKelvenToCelcius(currentWeather.Temp));
            tempLabel.Text = DisplayTextDataUtility.displayTemp(currentWeather.Temp);
            //feelsLikeLabel.Text = DisplayTextDataUtility.displayFeelsLike(ApiUtilities.convertKelvenToCelcius(currentWeather.FeelsLike));
            feelsLikeLabel.Text  = DisplayTextDataUtility.displayFeelsLike(currentWeather.FeelsLike);
            pressureLabel.Text   = DisplayTextDataUtility.displayPressure(currentWeather.Pressure);
            humidityLabel.Text   = DisplayTextDataUtility.displayhumidity(currentWeather.Humidity);
            windLabel.Text       = DisplayTextDataUtility.displaywind(currentWeather.WindSpeed, currentWeather.WindDirection);
            cloudCoverLabel.Text = DisplayTextDataUtility.displayCloudCover(currentWeather.CloudCover);
            currentWeatherIconImage.ImageLocation = ApiUtilities.getImageUrl(currentWeather.ImageIcon);
        }