示例#1
0
 private void RowWeather_Load(object sender, EventArgs e)
 {
     lblRow.Text   = Row.ToString();
     lblName.Text  = NamePersion;
     lblDegre.Text = Degre.ToString();
     if (Odd)
     {
         this.BackColor = Color.FromArgb(62, 62, 65);
     }
     picWeather.Image           = GetWeatherImage.GetImage(PictureWeather);
     lblWeatherDescription.Text = GetWeatherImage.GetDescription(PictureWeather);
 }
示例#2
0
        private void GetFavoritesInfo(string cityName)
        {
            var result = openWeatherMapApi.GetApiResult(cityName, _apiKey);

            lblCity.Text     = Properties.Settings.Default.CityNamePersion;
            lblCityMain.Text = Properties.Settings.Default.CityNamePersion;
            lblLat.Text      = result.coord.lat;
            lblLng.Text      = result.coord.lon;
            lblTemp.Text     = GetWeatherImage.ConvertKelvinToCantigerad(result.main.temp);
            lblSpeed.Text    = result.wind.speed.ToString();
            lblHumidity.Text = result.main.humidity.ToString();
            lblPressure.Text = result.main.pressure;

            lblSunrise.Text = GetWeatherImage.ConvertUnixToDateTime
                                  (double.Parse(result.sys.sunrise.ToString()));
            lblSunset.Text = GetWeatherImage.ConvertUnixToDateTime
                                 (double.Parse(result.sys.sunset.ToString()));

            picWeather.Image    = GetWeatherImage.GetImage(result.weather[0].id);
            lblDescription.Text = GetWeatherImage.GetDescription(result.weather[0].id);
        }