コード例 #1
0
ファイル: CityWeather.cs プロジェクト: aritzcovan/ezweather
 public CityWeather(string cityAndState, IWeatherService weatherService)
 {
     _wf = new ObservableCollection<WeatherForecast>();
     _wc = new CurrentWeatherConditions();
     _weatherService = weatherService;
     _cityAndState = cityAndState;
     LoadWeather();
 }
コード例 #2
0
ファイル: WeatherResult.cs プロジェクト: aritzcovan/ezweather
 public WeatherResult()
 {
     _forecast = new ObservableCollection<WeatherForecast>();
     _weatherConditions = new CurrentWeatherConditions();
 }
コード例 #3
0
 private CurrentWeatherConditions MapCurrentConditions(xml_api_reply r)
 {
     CurrentWeatherConditions currentConditions = null;
     try
     {
         currentConditions = new CurrentWeatherConditions()
                                     {
                                         City = r.weather[0].forecast_information[0].city[0].data,
                                         PostalCode = r.weather[0].forecast_information[0].postal_code[0].data,
                                         ForecastDate = Convert.ToDateTime(r.weather[0].forecast_information[0].forecast_date[0].data),
                                         CurrentCondition = r.weather[0].current_conditions[0].condition[0].data,
                                         CurrentHumidity = r.weather[0].current_conditions[0].humidity[0].data,
                                         CurrentWind = r.weather[0].current_conditions[0].wind_condition[0].data,
                                         CurrentIconUri = r.weather[0].current_conditions[0].icon[0].data.Replace("gif", "png"),
                                         CurrentF = Convert.ToDouble(r.weather[0].current_conditions[0].temp_f[0].data),
                                         CurrentC = Convert.ToDouble(r.weather[0].current_conditions[0].temp_c[0].data)
                                     };
     }
     catch (Exception e)
     {
     }
     return currentConditions ;
 }
コード例 #4
0
        private WeatherResult MapCurrentConditions(xml_api_reply r, WeatherResult wr)
        {
            try
            {
                wr.ActualCityName = r.weather[0].forecast_information[0].city[0].data;

                var currentConditions = new CurrentWeatherConditions()
                                            {
                                                City = r.weather[0].forecast_information[0].city[0].data,
                                                PostalCode = r.weather[0].forecast_information[0].postal_code[0].data,
                                                ForecastDate = Convert.ToDateTime(r.weather[0].forecast_information[0].forecast_date[0].data),
                                                CurrentCondition = r.weather[0].current_conditions[0].condition[0].data,
                                                CurrentHumidity = r.weather[0].current_conditions[0].humidity[0].data,
                                                CurrentWind = r.weather[0].current_conditions[0].wind_condition[0].data,
                                                CurrentIconUri = r.weather[0].current_conditions[0].icon[0].data.Replace("gif", "png"),
                                                CurrentF = Convert.ToDouble(r.weather[0].current_conditions[0].temp_f[0].data),
                                                CurrentC = Convert.ToDouble(r.weather[0].current_conditions[0].temp_c[0].data)
                                            };
                wr.WeatherConditions = currentConditions;
            }
            catch (Exception e)
            {
            }
            return wr;
        }