private async void BangumiListGridView_Loaded(object sender, RoutedEventArgs e) { if (_bangumiListViewLoaded) { return; } _bangumiListViewLoaded = true; StartLoadingAnimation(); var list = new List <BangumiViewModel>(); var infoList = await BiliFavHelper.GetFavBangumiMasterListAsync(1, Settings.Uid, Settings.SESSDATA); if (infoList.Count < 1) { list.Add(new BangumiViewModel() { Title = "追番为空", SeasonId = 0 }); } else { foreach (var bangumi in infoList) { var model = new BangumiViewModel() { Title = bangumi.Title, SeasonId = bangumi.SeasonId }; try { model.CoverImg = new BitmapImage(new Uri(bangumi.CoverUrl)); } catch (Exception ex) { _logger.Error(ex, ex.Message); } list.Add(model); } } list.Add(new BangumiViewModel() { Title = "加载更多", SeasonId = 0, //coverimage = ??? }); var collection = new ObservableCollection <BangumiViewModel>(list); BangumiListGridView.ItemsSource = collection; StopLoadingAnimation(); }
private async void BangumiListGridView_ItemClick(object sender, ItemClickEventArgs e) { var info = e.ClickedItem as BangumiViewModel; if (info.SeasonId == 0) { var list = BangumiListGridView.ItemsSource as ObservableCollection <BangumiViewModel>; var count = list.Count - 1; async Task NoticeNoMore() { var dialog = new NoticeDialog("提示", "已经没有更多了"); await dialog.ShowAsync(); } if ((count < 15) || (count % 15 != 0)) { await NoticeNoMore(); return; } var newList = await BiliFavHelper.GetFavBangumiMasterListAsync((count / 15) + 1, Settings.Uid, Settings.SESSDATA); if (newList == null) { await NoticeNoMore(); return; } var toAddList = new List <BangumiViewModel>(); list.Remove(list.Last()); foreach (var bangumi in newList) { var model = new BangumiViewModel() { Title = bangumi.Title, SeasonId = bangumi.SeasonId }; try { model.CoverImg = new BitmapImage(new Uri(bangumi.CoverUrl)); } catch (Exception ex) { _logger.Info(ex, ex.Message); } toAddList.Add(model); } toAddList.ForEach(b => list.Add(b)); list.Add(new BangumiViewModel() { Title = "加载更多", SeasonId = 0, //CoverImg = ??? }); } else { var master = await BiliBangumiHelper.GetBangumiMasterAsync(info.SeasonId, Settings.SESSDATA); NavigationHelper.NavigateToPage(ContentPage.Search); SearchPage.Current.HandleMaster <BiliBangumiMasterResultPage, BiliBangumiMaster>(master); } }