Beispiel #1
0
        private void ParseAsCurrent(Stream jsonStream)
        {
            CurrentConditionsWrapper myWrapper = CurrentWeatherGetter.TranslateJson <CurrentConditionsWrapper>(jsonStream);

            if (myWrapper == null)
            {
                return;
            }

            CurrentWeatherViewModel myView = new CurrentWeatherViewModel(myWrapper);

            //ObservableCollection<CurrentWeatherViewModel> newDataContext = new ObservableCollection<CurrentWeatherViewModel>();
            //newDataContext.Add(new CurrentWeatherViewModel(myWrapper));
            this.control.Dispatcher.BeginInvoke(delegate { control.DataContext = myView; });
        }
Beispiel #2
0
        public CurrentWeatherViewModel(CurrentConditionsWrapper weatherData)
        {
            if (weatherData == null)
            {
                throw new ArgumentNullException();
            }

            City      = weatherData.current_observation.display_location.city.ToLower();
            Latitude  = weatherData.current_observation.display_location.latitude.ToLower();
            Longitude = weatherData.current_observation.display_location.longitude.ToLower();
            Zip       = weatherData.current_observation.display_location.zip.ToLower();
            Condition = weatherData.current_observation.weather.ToLower();
            //Weekday = DateTime.Now.DayOfWeek.ToString().ToLower();
            Weekday = "today";

            _tempF = weatherData.current_observation.temp_f;
            _tempC = weatherData.current_observation.temp_c;
        }