Ejemplo n.º 1
0
        // Copies temperature data from ApiLibrary structures to new structures prepared for chart display
        /// <summary>
        /// Copies temperature data from ApiLibrary structures to new structures prepared for chart display.
        /// </summary>
        /// <param name="dailyForecastSource">DailyWeatherInfoModel object containing day temperature information.</param>
        public DailyTemperatureForecast(DailyWeatherInfoModel dailyForecastSource)
        {
            MorningTemperature = new List <TempForecastData>();
            DayTemperature     = new List <TempForecastData>();
            EveningTemperature = new List <TempForecastData>();
            NightTemperature   = new List <TempForecastData>();
            int i = 0;

            foreach (var item in dailyForecastSource.Daily)
            {
                string requiredDate = NormalizationOperations.NormalizeDate(dailyForecastSource.Daily[i].Dt);
                MorningTemperature.Add(new TempForecastData(NormalizationOperations.NormalizeTemperature(dailyForecastSource.Daily[i].Temp.Morn), requiredDate));
                DayTemperature.Add(new TempForecastData(NormalizationOperations.NormalizeTemperature(dailyForecastSource.Daily[i].Temp.Day), requiredDate));
                EveningTemperature.Add(new TempForecastData(NormalizationOperations.NormalizeTemperature(dailyForecastSource.Daily[i].Temp.Eve), requiredDate));
                NightTemperature.Add(new TempForecastData(NormalizationOperations.NormalizeTemperature(dailyForecastSource.Daily[i].Temp.Night), requiredDate));
                i++;
            }
        }
        // Copies daily weather forecast data from ApiLibrary structures to new structures prepared for chart display
        /// <summary>
        /// Copies daily weather forecast data from ApiLibrary structures to new structures prepared for chart display.
        /// </summary>
        /// <param name="dailyForecastSource">DailyWeatherInfoModel object containing daily weather forecast information.</param>
        public DailyWeatherForecast(DailyWeatherInfoModel dailyForecastSource)
        {
            dailyTemperatureForecast         = new DailyTemperatureForecast(dailyForecastSource);
            dailyApparentTemperatureForecast = new DailyApparentTemperatureForecast(dailyForecastSource);

            humidity  = new List <HumidityForecastData>();
            pressure  = new List <PressureForecastData>();
            windSpeed = new List <WindSpeedForecastData>();

            int i = 0;

            foreach (var item in dailyForecastSource.Daily)
            {
                string requiredDate = NormalizationOperations.NormalizeDate(dailyForecastSource.Daily[i].Dt);
                humidity.Add(new HumidityForecastData(dailyForecastSource.Daily[i].Humidity, requiredDate));
                pressure.Add(new PressureForecastData(dailyForecastSource.Daily[i].Pressure, requiredDate));
                windSpeed.Add(new WindSpeedForecastData(dailyForecastSource.Daily[i].Wind_speed, requiredDate));
                i++;
            }
        }