예제 #1
0
        public static async Task <FavViewModel> CreateAsync(BiliFav fav)
        {
            var model = new FavViewModel()
            {
                Title = fav.Title,
                Id    = fav.Id
            };

            var list = new ObservableCollection <FavVideoViewModel>();

            foreach (var video in fav.VideoMasters)
            {
                list.Add(await FavVideoViewModel.CreateAsync(video.Title, video.Bv, video.CoverUrl));
            }

            list.Add(new FavVideoViewModel()
            {
                Bv       = "加载更多",
                Title    = "加载更多",
                CoverImg = new BitmapImage(new Uri("ms-appx:///Assets/LoadMore.png"))
            });

            model.VideoList = list;

            return(model);
        }
예제 #2
0
        private async Task FavListView_LoadItem(FavViewModel vm)
        {
            if (vm.VideoList.Count > 0)
            {
                return;
            }
            var fav = await BiliFavHelper.GetBiliFavAsync(vm.Id, 1, Settings.SESSDATA);

            if (fav.Id == 0)
            {
                var dialog = new NoticeDialog("提示", "已经没有更多了", "确定");
                await dialog.ShowAsync();

                return;
            }
            var list = new List <FavVideoViewModel>();

            foreach (var video in fav.VideoMasters)
            {
                list.Add(await FavVideoViewModel.CreateAsync(video.Title, video.Bv, video.CoverUrl));
            }
            list.ForEach(v => vm.VideoList.Add(v));
            vm.VideoList.Add(new FavVideoViewModel()
            {
                Bv       = "加载更多",
                Title    = "加载更多",
                CoverImg = new BitmapImage(new Uri("ms-appx:///Assets/LoadMore.png"))
            });
        }