Ejemplo n.º 1
0
        public async void RefreshCurrentConditionsAsync()
        {
            //this.IsBusy = true;
            //this.NeedsRefresh = false;

            //WeatherInformation results = await Helpers.WeatherHelper.GetCurrentConditionsAsync(this.CityName, this.CountryCode);

            //this.CurrentConditions.Conditions = results.Conditions;
            //this.CurrentConditions.Description = results.Description;
            //this.CurrentConditions.DisplayName = results.DisplayName;
            //this.CurrentConditions.Icon = results.Icon;
            //this.CurrentConditions.Id = results.Id;
            //this.CurrentConditions.MaxTemperature = results.MaxTemperature;
            //this.CurrentConditions.MinTemperature = results.MinTemperature;
            //this.CurrentConditions.Temperature = results.Temperature;
            //this.CurrentConditions.Humidity = results.Humidity;
            //this.CurrentConditions.TimeStamp = results.TimeStamp.ToLocalTime();

            //this.IsBusy = false;

            this.IsBusy       = true;
            this.NeedsRefresh = false;

            WeatherInformation results = null;

            switch (this.LocationType)
            {
            case LocationType.Location:
                if (this.Location == null)
                {
                    this.Location = await Helpers.LocationHelper.GetCurrentLocationAsync();
                }
                results = await Helpers.WeatherHelper.GetCurrentConditionsAsync(this.Location.Latitude, this.Location.Longitude);

                break;

            case LocationType.City:
                results = await Helpers.WeatherHelper.GetCurrentConditionsAsync(this.CityName, this.CountryCode);

                break;
            }

            this.CurrentConditions.Conditions     = results.Conditions;
            this.CurrentConditions.Description    = results.Description;
            this.CurrentConditions.DisplayName    = results.DisplayName;
            this.CurrentConditions.Icon           = results.Icon;
            this.CurrentConditions.Id             = results.Id;
            this.CurrentConditions.MaxTemperature = results.MaxTemperature;
            this.CurrentConditions.MinTemperature = results.MinTemperature;
            this.CurrentConditions.Temperature    = results.Temperature;
            this.CurrentConditions.Humidity       = results.Humidity;
            this.CurrentConditions.TimeStamp      = results.TimeStamp.ToLocalTime();

            this.IsBusy = false;
        }
Ejemplo n.º 2
0
        public async void RefreshCurrentConditionsAsync()
        {
            this.IsBusy       = true;
            this.NeedsRefresh = false;

            WeatherInformation results = await Helpers.WeatherHelper.GetCurrentConditionsAsync(this.CityName, this.CountryCode);

            this.CurrentConditions.Conditions     = results.Conditions;
            this.CurrentConditions.Description    = results.Description;
            this.CurrentConditions.DisplayName    = results.DisplayName;
            this.CurrentConditions.Icon           = results.Icon;
            this.CurrentConditions.Id             = results.Id;
            this.CurrentConditions.MaxTemperature = results.MaxTemperature;
            this.CurrentConditions.MinTemperature = results.MinTemperature;
            this.CurrentConditions.Temperature    = results.Temperature;
            this.CurrentConditions.Humidity       = results.Humidity;
            this.CurrentConditions.TimeStamp      = results.TimeStamp.ToLocalTime();

            this.IsBusy = false;
        }