public ForecastSummaryDisplayClass(List <ForecastDisplayClass> forcastDay)
        {
            try
            {
                _dayOfForcast = new DateTime();
                _dayOfForcast = forcastDay.FirstOrDefault().ForcastTime;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            MinDayTempValue = forcastDay.Min(x => x.Temprature);
            MaxDayTempValue = forcastDay.Max(x => x.Temprature);
            AvrDayTempValue = (forcastDay.Sum(x => x.Temprature) / forcastDay.Count());

            MinHummValue = forcastDay.Min(x => x.Humidity);
            MaxHummValue = forcastDay.Max(x => x.Humidity);

            MinPressure = forcastDay.Min(x => x.Pressure);
            MaxPressure = forcastDay.Max(x => x.Pressure);

            MinCloud = forcastDay.Min(x => x.CloudStatus);
            MaxCloud = forcastDay.Max(x => x.CloudStatus);


            List <WeatherDiscriptionCurrentClass> dummy = new List <WeatherDiscriptionCurrentClass>();

            // Bildinformationen für den Forcast
            List <WeatherDiscriptionCurrentClass> _dummyList = new List <WeatherDiscriptionCurrentClass>();

            foreach (ForecastDisplayClass b in forcastDay)
            {
                var wp = b.WeatherDiscriptionCurrentClass.FirstOrDefault();

                if (!dummy.Exists(x => x.StatusTxt == wp.StatusTxt))
                {
                    dummy.Add(wp);
                }
            }
            WeatherDiscriptionCurrentClass.Clear();

            foreach (WeatherDiscriptionCurrentClass we in dummy)
            {
                WeatherDiscriptionCurrentClass.Add(we);
            }
        }
Ejemplo n.º 2
0
        public ForecastDisplayClass(string forcastTime, double temp, int humi, int pressu, int cloudStat, List <WeatherGrapicsIconInfo> _weatherGrapicsIconInfos)
        {
            try
            {
                var d = System.Convert.ToDateTime(forcastTime);
                //Error wegen nicht reservierten Speicher ?????
                ForcastTime = d;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            try
            {
                List <WeatherDiscriptionCurrentClass> _dummyList = new List <WeatherDiscriptionCurrentClass>();
                foreach (WeatherGrapicsIconInfo b in _weatherGrapicsIconInfos)
                {
                    _dummyList.Add(new WeatherDiscriptionCurrentClass(b._id, b._description));
                }

                //var path = _weatherConditionClass.ConditionList.Where(x => x.ConditionID == weatherIconID).FirstOrDefault().ConditionImagePath;
                //ForcastWeatherIcon = new BitmapImage(new Uri(Directory.GetCurrentDirectory() + path.AbsolutePath, UriKind.Absolute));
                WeatherDiscriptionCurrentClass.Clear();
                WeatherDiscriptionCurrentClass = _dummyList;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            Temprature  = temp;
            Humidity    = humi;
            Pressure    = pressu;
            CloudStatus = cloudStat;
            //StatusTxt = statusTxt;
        }