Exemplo n.º 1
0
        public MainPageViewModel()
        {
            this.forecastService = new ForecastService();
            this.forecastService.OnWeatherReady   += UpdateWeather;
            this.forecastService.OnForecastsReady += UpdateForecasts;
            this.cities   = forecastService.GetCities();
            FavoredCities = new ObservableCollection <City>(forecastService.GetFavoriteCities());
            Forecast      = new ObservableCollection <ForecastDTO>();

            GetWeatherCommand     = new RelayCommand(GetWeather);
            AddCityCommand        = new RelayCommand(AddCity);
            DeleteCityCommand     = new RelayCommand(DeleteCity);
            SelectForecastCommand = new RelayCommand(SelectForecast);

            SearchResults = new ObservableCollection <City>();
            SearchText    = "";
        }