private void LoadList(PanoramType listType, bool refresh, string searchTerm) { string fileName = null; ObservableCollection <ItemViewModel> parentList = null; switch (listType) { case PanoramType.HotnewsType: fileName = Constants.HotnewsFileName; parentList = HotnewsItems; break; case PanoramType.BulletinType: fileName = Constants.BulletinFileName; parentList = BulletinItems; break; } if (String.IsNullOrEmpty(fileName)) { return; } // If a cached file exists, bind it first then go update unless we are refreshing if (!refresh) { var itemList = BaseHelper.LoadSetting <List <ItemViewModel> >(fileName); if (itemList != null) { BindList(parentList, itemList); } } var RssHelper = new RssHelper(); RssHelper.LoadList(listType, (parentList != null && parentList.Count > 0) ? parentList[0].ViewId : 0, searchTerm); RssHelper.LoadedCompleteEvent += (sender, e) => { CheckCount(); var list = BaseHelper.LoadSetting <List <ItemViewModel> >(fileName); if (list == null) { //BaseHelper.ShowMessage("网络连接不稳定,请检查网络信号."); return; } Deployment.Current.Dispatcher.BeginInvoke(() => BindList(parentList, list)); }; }
public void LoadList(PanoramType listType, long sinceId, string searchTerm) { switch (listType) { case PanoramType.HotnewsType: LoadHotnews(sinceId); break; case PanoramType.BulletinType: LoadBulletin(sinceId); break; default: return; } }
private void LoadList(PanoramType listType, bool refresh) { LoadList(listType, refresh, String.Empty); }