public void AddNearSeaItems(List <RichListItem> listNearSea) { for (int i = 0; i < listNearSea.Count; ++i) { RichListItem item = listNearSea[i]; RichListItem newItem = new RichListItem(); newItem.Title = Constants.PREFIX_VALIDTIME; newItem.Description = item.Description; newItem.StartTime = item.StartTime; newItem.EndTime = item.EndTime; newItem.ValidTime = String.Format("{0} - {1}", item.StartTime, item.EndTime); newItem.Wave = item.Wave; newItem.WaveLevel = item.WaveLevel; newItem.WindScale = item.WindScale; newItem.Wind = item.Wind; newItem.ItemType = item.ItemType; newItem.ItemTemplate = item.ItemTemplate; String strWeatherImage = UtilityHelper.GetImageByWeatherDescription(item.Description, Constants.DEFAULT_TIMEBLOCK_DESCRIPTION); newItem.Icon = strWeatherImage; ListItemSource.Add(newItem); } NotifyPropertyChanged("ListItemSource"); }
public void AddWeekItems(List <RichListItem> listWeek) { for (int i = 0; i < listWeek.Count; ++i) { RichListItem item = listWeek[i]; RichListItem newItem = new RichListItem(); newItem.Description = item.Description; String strTime = ""; if (item.Day == null || "".Equals(item.Day)) { strTime = item.StartTime; } else { strTime = String.Format("{0} - {1}", item.StartTime, item.Day); } newItem.StartTime = strTime; newItem.Temperature = String.Format("{0}{1}", item.Temperature, Constants.SUFFIX_TEMPERATURE); newItem.ItemType = item.ItemType; newItem.ItemTemplate = item.ItemTemplate; ListItemSource.Add(newItem); } NotifyPropertyChanged("ListItemSource"); }
public void AddForecastItems(List <RichListItem> listForecast) { if (listForecast == null || listForecast.Count <= 0) { HandleNullData(true); } else { for (int i = 0; i < listForecast.Count; ++i) { RichListItem item = listForecast[i]; RichListItem newItem = new RichListItem(); newItem.Title = item.Title; newItem.Description = item.Description; newItem.Area = item.Area; newItem.Temperature = String.Format("{0}{1}", item.Temperature, Constants.SUFFIX_TEMPERATURE); newItem.ChanceOfRain = String.Format("{0}{1}{2}", Constants.PREFIX_CHANCE_OF_RAIN, item.ChanceOfRain, Constants.SUFFIX_CHANCE_OF_RAIN); newItem.StartTime = item.StartTime; newItem.EndTime = item.EndTime; newItem.ItemType = item.ItemType; newItem.ItemTemplate = item.ItemTemplate; String strWeatherImage = UtilityHelper.GetImageByWeatherDescription(item.Description, newItem.Title); newItem.Icon = strWeatherImage; ListItemSource.Add(newItem); } } NotifyPropertyChanged("ListItemSource"); }
private void ReflashByLocalData() { ListItemSource.Clear(); if (LoadDataStarted != null) { LoadDataStarted(); } List <SimpleListItem> list = XMLListDataReader.ReadListData(new Uri(ContentURL, UriKind.Relative)); foreach (SimpleListItem item in list) { ListItemSource.Add(new RichListItem() { Title = item.Title, ItemType = item.ItemType, URL = item.URL, ItemTemplate = item.ItemTemplate, SubItemTemplate = item.SubItemTemplate }); } NotifyPropertyChanged("ListItemSource"); if (LoadDataCompleted != null) { LoadDataCompleted(); } }
public void AddTideItems(List <RichListItem> listTide) { for (int i = 0; i < listTide.Count; ++i) { RichListItem item = listTide[i]; RichListItem newItem = new RichListItem(); newItem.Description = item.Description; newItem.StartTime = item.StartTime; newItem.LunarDate = item.LunarDate; newItem.ItemType = item.ItemType; newItem.ItemTemplate = item.ItemTemplate; ListItemSource.Add(newItem); } NotifyPropertyChanged("ListItemSource"); }
public void AddSeaItems(List <RichListItem> listSea) { for (int i = 0; i < listSea.Count; ++i) { RichListItem item = listSea[i]; RichListItem newItem = new RichListItem(); newItem.StartTime = item.StartTime; newItem.Wave = item.Wave; newItem.Description = item.Description; newItem.Wind = item.Wind; newItem.WindScale = item.WindScale; String strWeatherImage = UtilityHelper.GetImageByWeatherDescription(item.Description, Constants.DEFAULT_TIMEBLOCK_DESCRIPTION); newItem.Icon = strWeatherImage; newItem.ItemType = item.ItemType; newItem.ItemTemplate = item.ItemTemplate; ListItemSource.Add(newItem); } NotifyPropertyChanged("ListItemSource"); }
public void AddGlobalItems(List <RichListItem> listGlobal) { for (int i = 0; i < listGlobal.Count; ++i) { RichListItem item = listGlobal[i]; RichListItem newItem = new RichListItem(); newItem.Description = item.Description; //newItem.AvgRain = String.Format("{0}{1}{2}", Constants.PREFIX_AVGRAINSCALE, item.AvgRain, Constants.SUFFIX_RAINSCALE); //newItem.Temperature = String.Format("{0}{1}{2}", Constants.PREFIX_TEMPERATURE, item.Temperature, Constants.SUFFIX_TEMPERATURE); //newItem.AvgTemperature = String.Format("{0}{1}{2}", Constants.PREFIX_AVGTEMPERATURE, item.AvgTemperature, Constants.SUFFIX_TEMPERATURE); newItem.AvgRain = item.AvgRain; newItem.Temperature = String.Format("{0}{1}", item.Temperature, Constants.SUFFIX_TEMPERATURE); newItem.AvgTemperature = String.Format("{0}{1}", item.AvgTemperature, Constants.SUFFIX_TEMPERATURE); String strWeatherImage = UtilityHelper.GetImageByWeatherDescription(item.Description, Constants.DEFAULT_TIMEBLOCK_DESCRIPTION); newItem.Icon = strWeatherImage; newItem.ItemType = item.ItemType; newItem.ItemTemplate = item.ItemTemplate; ListItemSource.Add(newItem); } NotifyPropertyChanged("ListItemSource"); }
public void AddOBSItems(List <RichListItem> listOBS) { for (int i = 0; i < listOBS.Count; ++i) { RichListItem item = listOBS[i]; RichListItem newItem = new RichListItem(); newItem.Description = item.Description; newItem.GustWindScale = String.Format("{0}{1}{2}", Constants.PREFIX_GUSTWINDSCALE, item.GustWindScale, Constants.SUFFIX_GUSTWINDSCALE); newItem.RainScale = String.Format("{0}{1}{2}", Constants.PREFIX_RAINSCALE, item.RainScale, Constants.SUFFIX_RAINSCALE); newItem.Area = item.Area; newItem.StartTime = String.Format("{0}{1}", Constants.PREFIX_PUBLISH_TIME, item.StartTime); newItem.WindDirection = String.Format("{0}{1}", Constants.PREFIX_WINDDIRECTION, item.WindDirection); newItem.WindScale = String.Format("{0}{1}{2}", Constants.PREFIX_WINDSCALE, item.WindScale, Constants.SUFFIX_WINDSCALE); newItem.Temperature = String.Format("{0}{1}{2}", Constants.PREFIX_TEMPERATURE, item.Temperature, Constants.SUFFIX_TEMPERATURE); String strWeatherImage = UtilityHelper.GetImageByWeatherDescription(item.Description); newItem.Icon = strWeatherImage; newItem.ItemType = item.ItemType; newItem.ItemTemplate = item.ItemTemplate; ListItemSource.Add(newItem); } NotifyPropertyChanged("ListItemSource"); }