コード例 #1
0
        private async void GetWeatherButton_Click(object sender, RoutedEventArgs e)
        {
            if (!String.IsNullOrEmpty(nameEntry.Text))
            {
                Weather weather = await WeatherServices.GetWeather(nameEntry.Text);

                locationText.Text   = weather.Title;
                tempText.Text       = weather.Temperature;
                windText.Text       = weather.Wind;
                visibilityText.Text = weather.Visibility;
                humidityText.Text   = weather.Humidity;
                sunriseText.Text    = weather.Sunrise;
                sunsetText.Text     = weather.Sunset;

                weatherBtn.Content = "Search Again";
            }
        }
コード例 #2
0
        private async void Button_Click(object sender, EventArgs e)
        {
            EditText nameEntry = FindViewById <EditText>(Resource.Id.zipCodeEntry);

            if (!String.IsNullOrEmpty(nameEntry.Text))
            {
                Weather weather = await WeatherServices.GetWeather(nameEntry.Text);

                if (weather != null)
                {
                    FindViewById <TextView>(Resource.Id.locationText).Text   = weather.Title;
                    FindViewById <TextView>(Resource.Id.tempText).Text       = weather.Temperature;
                    FindViewById <TextView>(Resource.Id.windText).Text       = weather.Wind;
                    FindViewById <TextView>(Resource.Id.visibilityText).Text = weather.Visibility;
                    FindViewById <TextView>(Resource.Id.humidityText).Text   = weather.Humidity;
                    FindViewById <TextView>(Resource.Id.sunriseText).Text    = weather.Sunrise;
                    FindViewById <TextView>(Resource.Id.sunsetText).Text     = weather.Sunset;
                }
            }
        }