Пример #1
0
        private void WeatherInit()
        {
            AlarmCityMenuModel alarmCityMenuModel = WeatherHelper.NewAlarmCityMenuModel();

            AllWeahterModelList.Clear();

            foreach (var city in SavedCityInfoList)
            {
                try
                {
                    WeatherModel getOneWeatherModel = WeatherHelper.GetWeatherModel(city.CityCode, alarmCityMenuModel);
                    AllWeahterModelList.Add(getOneWeatherModel);
                }
                catch (Exception ex)
                {
                    ShowErrorInfoStr(city.CityName + " 天气更新时发生一个错误!\n" + ex.Message);
                }
            }

            //默认显示第一个城市 和第一天的8小时天气
            if (AllWeahterModelList.Count > 0)
            {
                GetWeatherModel = AllWeahterModelList[0];
                if (GetWeatherModel.Weather8Hours.Count > 0)
                {
                    GetCityHourWeather = GetWeatherModel.Weather8Hours[0].ToList();
                }
            }
        }