Ejemplo n.º 1
0
        public async Task RefreshForecastAsync()
        {
            IsBusy       = true;
            NeedsRefresh = false;

            WeatherInformation.Forecast results = null;

            Forecast.Clear();

            switch (LocationType)
            {
            case LocationType.Location:

                if (Location == null)
                {
                    Location = await LocationHelper.GetCurrentLocationAsync();
                }
                results = await WeatherHelper.GetForecastAsync(Location.Latitude, Location.Longitude);

                break;

            case LocationType.City:
                results = await WeatherHelper.GetForecastAsync(CityName, CountryCode);

                break;
            }



            IsBusy = false;
        }
Ejemplo n.º 2
0
        public MainViewModel()
        {
            IsBusy       = true;
            NeedsRefresh = true;
            LocationType = LocationType.City;
            CityName     = "Amsterdam";
            CountryCode  = "NL";
            //ResponseWeather
            CurrentConditionsResponse = new WeatherInformation.ResponseWeather();
            CurrentConditionsCoord    = new WeatherInformation.Coord();
            //CurrentConditionsWeather = new List<WeatherInformation.Weather>();
            CurrentConditionsWeather = new WeatherInformation.Weather();
            CurrentConditionsMain    = new WeatherInformation.Main();
            CurrentConditionsWind    = new WeatherInformation.Wind();
            CurrentConditionsClouds  = new WeatherInformation.Clouds();
            CurrentConditionsSys     = new WeatherInformation.Sys();
            ChangedConditions        = new ChangedViewModel(CurrentConditionsMain);

            //Forecast
            ForecastConditionsResponse = new WeatherInformation.Forecast();
            ForeCastConditionsCod      = new List <WeatherInformation.list>();
        }