GetWeather() публичный статический Метод

public static GetWeather ( string zipCode ) : Task
zipCode string
Результат Task
Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            Button button = FindViewById <Button>(Resource.Id.GetWeatherButton);

            button.Click += delegate
            {
                EditText ZipCodeEditText = FindViewById <EditText>(Resource.Id.ZipCodeEdit);

                Weather weather = Core.GetWeather(ZipCodeEditText.Text).Result;

                if (weather != null)
                {
                    FindViewById <TextView>(Resource.Id.ResultsTitle).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;

                    button.Text = "Search Again";
                }
                else
                {
                    FindViewById <TextView>(Resource.Id.ResultsTitle).Text = "Couldn't find any results";
                }
            };
        }
Пример #2
0
        private async void GetWeatherButton_Clicked(object sender, EventArgs e)
        {
            var weather = await Core.GetWeather(ZipCodeEntry.Text);

            BindingContext     = weather;
            GetWeatherBtn.Text = "Search Again";
        }
Пример #3
0
 private async void GetWeatherBtn_Clicked(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(zipCodeEntry.Text))
     {
         Weather weather = await Core.GetWeather(zipCodeEntry.Text); this.BindingContext = weather;
         getWeatherBtn.Text = "Search Again";
     }
 }
Пример #4
0
        private async void GetWeatherBtn_Clicked(object sender, EventArgs e)
        {
            if (zipCodeEntry.Text != null)
            {
                Weather weather = await Core.GetWeather(zipCodeEntry.Text);

                this.BindingContext = weather;
                getWeatherBtn.Text  = "search again";
            }
        }
Пример #5
0
        private async void GetWeatherBtn_Clicked(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(zipCodeEntry.Text))
            {
                Weather weather = await Core.GetWeather(zipCodeEntry.Text, (string)unitOfMeasure.SelectedItem);

                if (weather != null)
                {
                    this.BindingContext = weather;
                    getWeatherBtn.Text  = "Search Again";
                }
            }
        }
Пример #6
0
        private async void GetWeatherBtn_Clicked(object sender, EventArgs e) // Statisk klasse, der overskriver eksisterende vejrdata og indsætter nye
        {
            if (!String.IsNullOrEmpty(zipCodeEntry.Text))
            {
                Weather weather = await Core.GetWeather(zipCodeEntry.Text);

                if (weather != null)
                {
                    this.BindingContext = weather;
                    getWeatherBtn.Text  = "Search Again";
                }
            }
        }
Пример #7
0
        private async void GetWeatherBtn_Clicked(object sender, EventArgs e)
        {
            //if (!String.IsNullOrEmpty(zipCodeEntry.Text))
            if (!String.IsNullOrEmpty(byNavnEntry.Text))
            {
                //Weather weather = await Core.GetWeather(zipCodeEntry.Text);
                Weather weather = await Core.GetWeather(byNavnEntry.Text);

                if (weather != null)
                {
                    this.BindingContext = weather;
                    getWeatherBtn.Text  = "Søg igen";
                }
            }
        }
Пример #8
0
        private async void Button_Click(object sender, EventArgs e)
        {
            EditText zipCodeEntry = FindViewById <EditText>(Resource.Id.zipCodeEntry);

            if (!String.IsNullOrEmpty(zipCodeEntry.Text))
            {
                Weather weather = await Core.GetWeather(zipCodeEntry.Text);

                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;
            }
        }
        private async void Button_Clicked(object sender, EventArgs e)
        {
            UserDialogs.Instance.ShowLoading("Loading Data...");
            String city = search.Text;

            Weather result = await Core.GetWeather(city);


            place.Text       = result.Title;
            description.Text = result.description;
            temp.Text        = result.Tempurature;
            humidity.Text    = result.Humidity + "%";
            wind.Text        = result.Wind + "m/h";



            sunrize.Text = result.Sunrize;
            sunset.Text  = result.Sunset;

            UserDialogs.Instance.HideLoading();
        }
Пример #10
0
        //int count = 1;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            Button button = FindViewById <Button>(Resource.Id.GetWeatherButton);

            button.Click += delegate
            {
                EditText ZipCodeEditText = FindViewById <EditText>(Resource.Id.ZipCodeEdit);

                Weather weather = Core.GetWeather(ZipCodeEditText.Text).Result;

                if (weather != null)
                {
                    FindViewById <TextView>(Resource.Id.ResultsTitle).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;

                    button.Text = "Search Again";
                }
                else
                {
                    FindViewById <TextView>(Resource.Id.ResultsTitle).Text = "Couldn't find any results";
                }
            };

            // Get our button from the layout resource,
            // and attach an event to it
            //Button button = FindViewById<Button>(Resource.Id.MyButton);

            //button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
        }
Пример #11
0
        private async void GetWeatherBtn_Clicked(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(cityEntry.Text) && dateXML.Date.Day > 0)
            {
                Weather weather = await Core.GetWeather(cityEntry.Text, dateXML.Date);

                if (weather != null)
                {
                    this.BindingContext = weather;
                    w = weather;
                    canvas.InvalidateSurface();
                    getWeatherBtn.Text = "Search Again";
                }
                else
                {
                    this.BindingContext = weather;
                    getWeatherBtn.Text  = "Error";
                }
            }
            else
            {
                getWeatherBtn.Text = "Fill in all fields";
            }
        }
Пример #12
0
        private async void GetWeatherBtn_Clicked(object sender, EventArgs e)
        {
            Weather weather = await Core.GetWeather("27203");

            getWeatherBtn.Text = weather.Title;
        }
Пример #13
0
        private async void Weather_Clicked(object sender, EventArgs e)
        {
            Weather weatherData = await Core.GetWeather(_zipCodeEntry.Text);

            BindingContext = weatherData;
        }
Пример #14
0
        protected override void OnStart()
        {
         if (!String.IsNullOrEmpty (FavoriteCityLabel.Text))
            {
		    Weather weather = await Core.GetWeather						(FavoriteCityLabel.Text);
            }