private void GetYahooWeatherDetails() { YahooWeather _weather = new YahooWeather(SelectedCity.Name); string url = _weather.BuildUrl(); YahooWeatherDetails weatherDetails = _weather.GetYahooWeatherDetails(url); _weatherDetails = weatherDetails; LoadYahooWeatherDates(weatherDetails); }
private void LoadYahooWeatherDates(YahooWeatherDetails wd) { Dates = new ObservableCollection<string>(); wd.query.results.channel.item.forecast.ForEach(x => { if (DateTime.Parse(x.date) <= DateTime.Today.AddDays(4)) Dates.Add(x.date); }); RaisePropertyChanged("Dates"); }
private void GetYahooWeatherDetailsOffline(string city) { YahooWeather _weather = new YahooWeather(SelectedCity.Name); string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory.Replace("bin\\Debug\\", "Offline Datas\\"), string.Format("{0}\\{1}.txt", SelectedWeatherSource, city)); if (!File.Exists(path)) throw new Exception(string.Format("Please download the data for {0} to work in offline mode.", city)); YahooWeatherDetails weatherDetails = _weather.GetYahooWeatherDetailsOffline(File.ReadAllText(path)); _weatherDetails = weatherDetails; LoadYahooWeatherDates(weatherDetails); }
public YahooWeatherViewModel(YahooWeatherDetails weatherInfo) { _weatherInfo = weatherInfo; }