private List <WeatherAlarmType> GetWeatherAlarms(HalfDayForecastModel halfDayForecastModel)
        {
            this.GetWeatherAlarmThresholdValues();
            List <WeatherAlarmType> weatherAlarmTypes = new List <WeatherAlarmType>();

            if (halfDayForecastModel.PrecipationAmountIce > this._weatherAlarmThresholdIce)
            {
                weatherAlarmTypes.Add(WeatherAlarmType.Ice);
            }
            if (halfDayForecastModel.PrecipationAmountRain > this._weatherAlarmThresholdRain)
            {
                weatherAlarmTypes.Add(WeatherAlarmType.Rain);
            }
            if (halfDayForecastModel.PrecipationAmountSnow > this._weatherAlarmThresholdSnow)
            {
                weatherAlarmTypes.Add(WeatherAlarmType.Snow);
            }
            if (halfDayForecastModel.PrecipationAmountThunderstorms > this._weatherAlarmThresholdThunderstorm)
            {
                weatherAlarmTypes.Add(WeatherAlarmType.Thunderstorm);
            }
            if ((Double)halfDayForecastModel.WindSpeed > this._weatherAlarmThresholdWindSpeed)
            {
                weatherAlarmTypes.Add(WeatherAlarmType.WindSpeed);
            }
            if ((Double)halfDayForecastModel.GustSpeed > this._weatherAlarmThresholdWindGusts)
            {
                weatherAlarmTypes.Add(WeatherAlarmType.WindGust);
            }
            return(weatherAlarmTypes);
        }
        public async Task <ObservableCollection <HalfDayForecastModel> > GetHalfDayForecastsAsync(String locationID, Boolean forceUpdate = false, Boolean getDetails = true, WeatherUnitTypes metric = WeatherUnitTypes.Metric)
        {
            ObservableCollection <HalfDayForecastModel> observableCollection;
            Boolean flag;
            List <WeatherAlarmType> weatherAlarmTypes;
            Boolean flag1;
            Boolean flag2;
            String  str;
            Boolean flag3;
            List <WeatherAlarmType> weatherAlarmTypes1;
            Boolean flag4;
            Boolean flag5;

            if (getDetails)
            {
                //WeatherDataService._resourceLoader = ResourceLoader.GetForCurrentView("ClubCloud.Afhangen.UILogic.Services/Resources");
            }
            ObservableCollection <HalfDayForecastModel> text = new ObservableCollection <HalfDayForecastModel>();

            if (WeatherRepository.IsNetworkAvailable())
            {
                await this.GetForecastSummaryAsync(locationID, forceUpdate, metric);

                if (this._forecastSummary != null)
                {
                    this._forecastSummary.LocationId = locationID;
                    this._forecastSummary.UpDateTime = DateTime.UtcNow;
                    Int32 num = 0;
                    foreach (DailyForecast dailyForecast in this._forecastSummary.DailyForecasts)
                    {
                        HalfDayForecastModel halfDayForecastModel = new HalfDayForecastModel()
                        {
                            ShortPhrase = dailyForecast.Day.ShortPhrase
                        };
                        if (dailyForecast.Day.Icon.HasValue)
                        {
                            halfDayForecastModel.WeatherCode = dailyForecast.Day.Icon.Value;
                        }
                        if (getDetails)
                        {
                            halfDayForecastModel.ForecastType             = HalfDayForecastType.Day;
                            halfDayForecastModel.Date                     = dailyForecast.Date.Date;
                            halfDayForecastModel.ShortDate                = dailyForecast.Date.ToString("ddd. M/d");
                            halfDayForecastModel.LongDate                 = dailyForecast.Date.ToString("dddd, MMMM d");
                            halfDayForecastModel.PredictedHi              = Convert.ToInt32(WeatherRepository.MathRound(dailyForecast.Temperature.Maximum.NumericValue));
                            halfDayForecastModel.PredictedHiUnit          = dailyForecast.Temperature.Maximum.Unit;
                            halfDayForecastModel.PredictedLow             = Convert.ToInt32(WeatherRepository.MathRound(dailyForecast.Temperature.Minimum.NumericValue));
                            halfDayForecastModel.PredictedLowUnit         = dailyForecast.Temperature.Minimum.Unit;
                            halfDayForecastModel.PredictedRealFeelLow     = Convert.ToInt32(WeatherRepository.MathRound(dailyForecast.RealFeelTemperature.Minimum.NumericValue));
                            halfDayForecastModel.PredictedRealFeelLowUnit = dailyForecast.RealFeelTemperature.Minimum.Unit;
                            halfDayForecastModel.PredictedRealFeelHi      = Convert.ToInt32(WeatherRepository.MathRound(dailyForecast.RealFeelTemperature.Maximum.NumericValue));
                            halfDayForecastModel.PredictedRealFeelHiUnit  = dailyForecast.RealFeelTemperature.Maximum.Unit;
                            halfDayForecastModel.WindDirection            = dailyForecast.Day.Wind.Direction.Localized;
                            halfDayForecastModel.WindSpeed                = Convert.ToInt32(WeatherRepository.MathRound(dailyForecast.Day.Wind.Speed.Metric.NumericValue));
                            halfDayForecastModel.WindSpeedUnit            = dailyForecast.Day.Wind.Speed.Metric.Unit;
                            halfDayForecastModel.GustSpeed                = Convert.ToInt32(WeatherRepository.MathRound(dailyForecast.Day.WindGust.Speed.Metric.NumericValue));
                            halfDayForecastModel.GustSpeedUnit            = dailyForecast.Day.WindGust.Speed.Metric.Unit;
                            if (dailyForecast.Day.PrecipitationProbability.HasValue)
                            {
                                Int32?precipitationProbability = dailyForecast.Day.PrecipitationProbability;
                                halfDayForecastModel.ProbabilityOfPrecipitation = String.Concat(precipitationProbability.Value, "%");
                            }
                            if (!dailyForecast.Day.RainProbability.HasValue || (Single)dailyForecast.Day.RainProbability.Value <= 0f && (Single)dailyForecast.Day.SnowProbability.Value <= 0f)
                            {
                                halfDayForecastModel.ProbabilityOfPrecipitationSub = "";
                            }
                            else
                            {
                                halfDayForecastModel.ProbabilityOfPrecipitationSub = "(";
                                if ((Single)dailyForecast.Day.RainProbability.Value > 0f)
                                {
                                    HalfDayForecastModel halfDayForecastModel1 = halfDayForecastModel;
                                    Object   probabilityOfPrecipitationSub     = halfDayForecastModel1.ProbabilityOfPrecipitationSub;
                                    Object[] value           = new Object[] { probabilityOfPrecipitationSub, "Regen", ": ", default(Object), default(Object) };
                                    Int32?   rainProbability = dailyForecast.Day.RainProbability;
                                    value[3] = rainProbability.Value;
                                    value[4] = "%";
                                    halfDayForecastModel1.ProbabilityOfPrecipitationSub = String.Concat(value);
                                }
                                if ((Single)dailyForecast.Day.SnowProbability.Value > 0f)
                                {
                                    if (halfDayForecastModel.ProbabilityOfPrecipitationSub.Length > 1)
                                    {
                                        HalfDayForecastModel halfDayForecastModel2 = halfDayForecastModel;
                                        halfDayForecastModel2.ProbabilityOfPrecipitationSub = String.Concat(halfDayForecastModel2.ProbabilityOfPrecipitationSub, " ");
                                    }
                                    HalfDayForecastModel halfDayForecastModel3 = halfDayForecastModel;
                                    Object   obj             = halfDayForecastModel3.ProbabilityOfPrecipitationSub;
                                    Object[] objArray        = new Object[] { obj, "Sneeuw", ": ", default(Object), default(Object) };
                                    Int32?   snowProbability = dailyForecast.Day.SnowProbability;
                                    objArray[3] = snowProbability.Value;
                                    objArray[4] = "%";
                                    halfDayForecastModel3.ProbabilityOfPrecipitationSub = String.Concat(objArray);
                                }
                                HalfDayForecastModel halfDayForecastModel4 = halfDayForecastModel;
                                halfDayForecastModel4.ProbabilityOfPrecipitationSub = String.Concat(halfDayForecastModel4.ProbabilityOfPrecipitationSub, ")");
                            }
                            halfDayForecastModel.PrecipationAmountIce       = Convert.ToDouble(dailyForecast.Day.Ice.NumericValue);
                            halfDayForecastModel.PrecipationAmountIceUnits  = dailyForecast.Day.Ice.Unit;
                            halfDayForecastModel.PrecipationAmountRain      = Convert.ToDouble(dailyForecast.Day.Rain.NumericValue);
                            halfDayForecastModel.PrecipationAmountRainUnits = dailyForecast.Day.Rain.Unit;
                            halfDayForecastModel.PrecipationAmountSnow      = Convert.ToDouble(dailyForecast.Day.Snow.NumericValue);
                            halfDayForecastModel.PrecipationAmountSnowUnits = dailyForecast.Day.Snow.Unit;
                            Int32?thunderstormProbability = dailyForecast.Day.ThunderstormProbability;
                            halfDayForecastModel.PrecipationAmountThunderstorms = Convert.ToInt32(thunderstormProbability.Value);
                            halfDayForecastModel.UV = dailyForecast.AirAndPollen[5].Category;
                            if (dailyForecast.Sun != null)
                            {
                                if (dailyForecast.Sun.Rise.HasValue)
                                {
                                    DateTimeOffset?rise = dailyForecast.Sun.Rise;
                                    halfDayForecastModel.Sunrise = rise.Value.ToString("h:mm tt");
                                }
                                if (dailyForecast.Sun.Set.HasValue)
                                {
                                    DateTimeOffset?set = dailyForecast.Sun.Set;
                                    halfDayForecastModel.Sunset = set.Value.ToString("h:mm tt");
                                }
                            }
                            HalfDayForecastModel halfDayForecastModel5 = halfDayForecastModel;
                            if (dailyForecast.Sources.ToList <String>() == null)
                            {
                                flag3 = false;
                            }
                            else
                            {
                                List <String> sources = dailyForecast.Sources;
                                flag3 = false;

                                /*
                                 * if (WeatherDataService.CS$<>9__CachedAnonymousMethodDelegate16 == null)
                                 * {
                                 *  WeatherDataService.CS$<>9__CachedAnonymousMethodDelegate16 = new Func<String, Boolean>(null, (String x) => x.ToUpper() == "HUAFENG");
                                 * }
                                 * flag3 = sources.Any<String>(WeatherDataService.CS$<>9__CachedAnonymousMethodDelegate16);
                                 */
                            }
                            halfDayForecastModel5.IsAttributed = flag3;
                            HalfDayForecastModel halfDayForecastModel6 = halfDayForecastModel;
                            weatherAlarmTypes1                   = (num < 4 ? this.GetWeatherAlarms(halfDayForecastModel) : new List <WeatherAlarmType>());
                            halfDayForecastModel6.Alarms         = weatherAlarmTypes1;
                            halfDayForecastModel.HasWeatherAlarm = halfDayForecastModel.Alarms.Any <WeatherAlarmType>();
                            HalfDayForecastModel halfDayForecastModel7 = halfDayForecastModel;
                            flag4 = (halfDayForecastModel.Alarms.Contains(WeatherAlarmType.Ice) || halfDayForecastModel.Alarms.Contains(WeatherAlarmType.Rain) || halfDayForecastModel.Alarms.Contains(WeatherAlarmType.Snow) ? true : halfDayForecastModel.Alarms.Contains(WeatherAlarmType.Thunderstorm));
                            halfDayForecastModel7.HasWeatherAlarmNonWind = flag4;
                            HalfDayForecastModel halfDayForecastModel8 = halfDayForecastModel;
                            flag5 = (halfDayForecastModel.Alarms.Contains(WeatherAlarmType.WindSpeed) ? true : halfDayForecastModel.Alarms.Contains(WeatherAlarmType.WindGust));
                            halfDayForecastModel8.HasWeatherAlarmWind = flag5;
                            halfDayForecastModel.UpdatedDateTime      = DateTime.Now;
                        }
                        text.Add(halfDayForecastModel);
                        HalfDayForecastModel date = new HalfDayForecastModel()
                        {
                            ShortPhrase = dailyForecast.Night.ShortPhrase
                        };
                        if (dailyForecast.Night.Icon.HasValue)
                        {
                            date.WeatherCode = dailyForecast.Night.Icon.Value;
                        }
                        if (getDetails)
                        {
                            date.ForecastType             = HalfDayForecastType.Night;
                            date.Date                     = dailyForecast.Date.Date;
                            date.ShortDate                = dailyForecast.Date.ToString("ddd. M/d");
                            date.LongDate                 = dailyForecast.Date.ToString("dddd, MMMM d");
                            date.PredictedHi              = Convert.ToInt32(WeatherRepository.MathRound(dailyForecast.Temperature.Maximum.NumericValue));
                            date.PredictedHiUnit          = dailyForecast.Temperature.Maximum.Unit;
                            date.PredictedLow             = Convert.ToInt32(WeatherRepository.MathRound(dailyForecast.Temperature.Minimum.NumericValue));
                            date.PredictedLowUnit         = dailyForecast.Temperature.Minimum.Unit;
                            date.PredictedRealFeelLow     = Convert.ToInt32(WeatherRepository.MathRound(dailyForecast.RealFeelTemperature.Minimum.NumericValue));
                            date.PredictedRealFeelLowUnit = dailyForecast.RealFeelTemperature.Minimum.Unit;
                            date.PredictedRealFeelHi      = Convert.ToInt32(WeatherRepository.MathRound(dailyForecast.RealFeelTemperature.Maximum.NumericValue));
                            date.PredictedRealFeelHiUnit  = dailyForecast.RealFeelTemperature.Maximum.Unit;
                            date.WindDirection            = dailyForecast.Night.Wind.Direction.Localized;
                            date.WindSpeed                = Convert.ToInt32(WeatherRepository.MathRound(dailyForecast.Night.Wind.Speed.Metric.NumericValue));
                            date.WindSpeedUnit            = dailyForecast.Night.Wind.Speed.Metric.Unit;
                            date.GustSpeed                = Convert.ToInt32(WeatherRepository.MathRound(dailyForecast.Night.WindGust.Speed.Metric.NumericValue));
                            date.GustSpeedUnit            = dailyForecast.Night.WindGust.Speed.Metric.Unit;
                            if (dailyForecast.Night.PrecipitationProbability.HasValue)
                            {
                                Int32?nullable = dailyForecast.Night.PrecipitationProbability;
                                date.ProbabilityOfPrecipitation = String.Concat(nullable.Value, "%");
                            }
                            if (!dailyForecast.Night.RainProbability.HasValue || (Single)dailyForecast.Night.RainProbability.Value <= 0f && (Single)dailyForecast.Night.SnowProbability.Value <= 0f)
                            {
                                date.ProbabilityOfPrecipitationSub = "";
                            }
                            else
                            {
                                date.ProbabilityOfPrecipitationSub = "(";
                                if ((Single)dailyForecast.Night.RainProbability.Value > 0f)
                                {
                                    HalfDayForecastModel halfDayForecastModel9 = date;
                                    Object   probabilityOfPrecipitationSub1    = halfDayForecastModel9.ProbabilityOfPrecipitationSub;
                                    Object[] str1             = new Object[] { probabilityOfPrecipitationSub1, "Regen", ": ", default(Object), default(Object) };
                                    Int32?   rainProbability1 = dailyForecast.Night.RainProbability;
                                    str1[3] = rainProbability1.Value;
                                    str1[4] = "%";
                                    halfDayForecastModel9.ProbabilityOfPrecipitationSub = String.Concat(str1);
                                }
                                if ((Single)dailyForecast.Night.SnowProbability.Value > 0f)
                                {
                                    if (date.ProbabilityOfPrecipitationSub.Length > 1)
                                    {
                                        HalfDayForecastModel halfDayForecastModel10 = date;
                                        halfDayForecastModel10.ProbabilityOfPrecipitationSub = String.Concat(halfDayForecastModel10.ProbabilityOfPrecipitationSub, " ");
                                    }
                                    HalfDayForecastModel halfDayForecastModel11 = date;
                                    Object   obj1             = halfDayForecastModel11.ProbabilityOfPrecipitationSub;
                                    Object[] value1           = new Object[] { obj1, "Sneeuw", ": ", default(Object), default(Object) };
                                    Int32?   snowProbability1 = dailyForecast.Night.SnowProbability;
                                    value1[3] = snowProbability1.Value;
                                    value1[4] = "%";
                                    halfDayForecastModel11.ProbabilityOfPrecipitationSub = String.Concat(value1);
                                }
                                HalfDayForecastModel halfDayForecastModel12 = date;
                                halfDayForecastModel12.ProbabilityOfPrecipitationSub = String.Concat(halfDayForecastModel12.ProbabilityOfPrecipitationSub, ")");
                            }
                            date.PrecipationAmountIce       = Convert.ToDouble(dailyForecast.Night.Ice.NumericValue);
                            date.PrecipationAmountIceUnits  = dailyForecast.Night.Ice.Unit;
                            date.PrecipationAmountRain      = Convert.ToDouble(dailyForecast.Night.Rain.NumericValue);
                            date.PrecipationAmountRainUnits = dailyForecast.Night.Rain.Unit;
                            date.PrecipationAmountSnow      = Convert.ToDouble(dailyForecast.Night.Snow.NumericValue);
                            date.PrecipationAmountSnowUnits = dailyForecast.Night.Snow.Unit;
                            Int32?thunderstormProbability1 = dailyForecast.Night.ThunderstormProbability;
                            date.PrecipationAmountThunderstorms = Convert.ToInt32(thunderstormProbability1.Value);
                            if (dailyForecast.Moon != null)
                            {
                                date.MoonPhaseEnglish = dailyForecast.Moon.Phase;
                                if (dailyForecast.Moon.Phase.Equals("WaningCrescent"))
                                {
                                    dailyForecast.Moon.Phase = "WaningCrecent";
                                }
                                HalfDayForecastModel str2 = date;
                                //ResourceLoader resourceLoader = WeatherDataService._resourceLoader;
                                str            = (dailyForecast.Moon.Phase == "New" ? "NewMoon" : dailyForecast.Moon.Phase);
                                str2.MoonPhase = str;// resourceLoader.GetString(str);
                                if (dailyForecast.Moon.Rise.HasValue)
                                {
                                    DateTimeOffset?rise1 = dailyForecast.Moon.Rise;
                                    date.Moonrise = rise1.Value.ToString("h:mm tt");
                                }
                                if (dailyForecast.Moon.Set.HasValue)
                                {
                                    DateTimeOffset?set1 = dailyForecast.Moon.Set;
                                    date.Moonset = set1.Value.ToString("h:mm tt");
                                }
                            }
                            HalfDayForecastModel halfDayForecastModel13 = date;
                            if (dailyForecast.Sources.ToList <String>() == null)
                            {
                                flag = false;
                            }
                            else
                            {
                                List <String> strs = dailyForecast.Sources;
                                flag3 = false;

                                /*
                                 * if (WeatherDataService.CS$<>9__CachedAnonymousMethodDelegate17 == null)
                                 * {
                                 *  WeatherDataService.CS$<>9__CachedAnonymousMethodDelegate17 = new Func<String, Boolean>(null, (String x) => x.ToUpper() == "HUAFENG");
                                 * }
                                 * flag = strs.Any<String>(WeatherDataService.CS$<>9__CachedAnonymousMethodDelegate17);
                                 */
                            }
                            //halfDayForecastModel13.IsAttributed = flag;
                            halfDayForecastModel13.IsAttributed = true;
                            HalfDayForecastModel halfDayForecastModel14 = date;
                            weatherAlarmTypes             = (num < 4 ? this.GetWeatherAlarms(date) : new List <WeatherAlarmType>());
                            halfDayForecastModel14.Alarms = weatherAlarmTypes;
                            date.HasWeatherAlarm          = date.Alarms.Any <WeatherAlarmType>();
                            HalfDayForecastModel halfDayForecastModel15 = date;
                            flag1 = (date.Alarms.Contains(WeatherAlarmType.Ice) || date.Alarms.Contains(WeatherAlarmType.Rain) || date.Alarms.Contains(WeatherAlarmType.Snow) ? true : date.Alarms.Contains(WeatherAlarmType.Thunderstorm));
                            halfDayForecastModel15.HasWeatherAlarmNonWind = flag1;
                            HalfDayForecastModel halfDayForecastModel16 = date;
                            flag2 = (date.Alarms.Contains(WeatherAlarmType.WindSpeed) ? true : date.Alarms.Contains(WeatherAlarmType.WindGust));
                            halfDayForecastModel16.HasWeatherAlarmWind = flag2;
                            halfDayForecastModel.UpdatedDateTime       = DateTime.Now;
                        }
                        text.Add(date);
                        num++;
                    }
                }
                if (text.Count() > 0)
                {
                    //text.Item(0).LocalForecastSummary = this._forecastSummary.Headline.Text;
                    //text.Item(0).LocalForecastSummarySeverity = this._forecastSummary.Headline.Severity;
                    //text.Item(0).LocalForecastSummaryEffectiveDate = this._forecastSummary.Headline.EffectiveDate;
                    observableCollection = text;
                }
                else
                {
                    observableCollection = text;
                }
            }
            else
            {
                //Messenger.Default.Send<ErrorMessageTypeMessage>(new ErrorMessageTypeMessage()
                //{
                //    ErrorCode = ErrorCodeType.UnableToConnectNetwork
                //});
                observableCollection = text;
            }
            return(observableCollection);
        }