Ejemplo n.º 1
0
        private void citiesList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            citiesList.Visibility = Visibility.Collapsed;
            string location = citiesList.SelectedValue.ToString();


            weather = new Weather();

            string city, country;
            int    comaIndex = location.IndexOf(',');

            country = location.Substring(comaIndex + 1);
            city    = location.Remove(comaIndex);


            City cityFound = CityList.FirstOrDefault <City>(c => c.name == city | c.country == country);

            weather.GetWeatherById(cityFound._id);

            lblLocation.Text         = weather.City + ", " + weather.Country;
            lblMinMaxTemp.Content    = weather.MinTemperature + "/" + weather.MaxTemperature;
            lblHumidity.Content      = weather.Humidity;
            lblDescription.Content   = weather.Sky;
            lblPressure.Content      = weather.Pressure;
            lblSunsetSunrise.Content = "Рассвет: " + weather.Sunrise + " Закат: " + weather.Sunset;
            lblWind.Content          = "Ветер: " + weather.WindSpeed;
            lblCurrentTemp.Content   = weather.Temperature;
            btnMap.Visibility        = Visibility.Visible;
        }
Ejemplo n.º 2
0
        private void citiesList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            citiesList.Visibility = Visibility.Collapsed;
                string location = citiesList.SelectedValue.ToString();

                weather = new Weather();

                string city, country;
                int comaIndex = location.IndexOf(',');
                country = location.Substring(comaIndex + 1);
                city = location.Remove(comaIndex);

                City cityFound = CityList.FirstOrDefault<City>(c => c.name == city | c.country == country);

                weather.GetWeatherById(cityFound._id);

                lblLocation.Text = weather.City + ", " + weather.Country;
                lblMinMaxTemp.Content = weather.MinTemperature + "/" + weather.MaxTemperature;
                lblHumidity.Content = weather.Humidity;
                lblDescription.Content = weather.Sky;
                lblPressure.Content = weather.Pressure;
                lblSunsetSunrise.Content = "Рассвет: " + weather.Sunrise + " Закат: " + weather.Sunset;
                lblWind.Content = "Ветер: " + weather.WindSpeed;
                lblCurrentTemp.Content = weather.Temperature;
                btnMap.Visibility = Visibility.Visible;
        }