private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { Pivot pivot = sender as Pivot; switch (pivot.SelectedIndex) { case 2: { if (!isFriendLoaded) { var list = await ContentServ.GetFriendsAsync(UserHelper.Mid, page_friend); if (list.isEmpty) { // 提示:没有关注的人 } else { for (int i = 0; i < list.List.Count; i++) { list_friends.Items.Add(list.List[i]); } } isFriendLoaded = true; } }; break; } }
private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { Pivot pivot = sender as Pivot; TextBlock txt = this.FindName(string.Format("h{0}", pivot.SelectedIndex)) as TextBlock; for (int i = 0; i < pivot.Items.Count; i++) { TextBlock temp = this.FindName(string.Format("h{0}", i)) as TextBlock; temp.Foreground = new SolidColorBrush(Colors.LightGray); } txt.Foreground = new SolidColorBrush(Colors.White); switch (pivot.SelectedIndex) { case 0: { if (gv_hot.Items.Count == 0) { var temp = await ContentServ.GetContentAsync(166, 1); foreach (var item in temp) { gv_hot.Items.Add(item); } } } break; } }
protected async override void OnNavigatedTo(NavigationEventArgs e) { string url = "http://bangumi.bilibili.com/api/tags?appkey=" + ApiHelper.appkey + "&build=424000&mobi_app=wp&platform=wp&page=1&pagesize=60&ts=" + ApiHelper.GetLinuxTS().ToString(); url += ApiHelper.GetSign(url); List <Tags> tags = await ContentServ.GetTagsAsync(url); if (WebStatusHelper.IsOnline()) { gridview.Items.Add(new Tags { Cover = "http://i0.hdslb.com/bfs/bangumi/2da98805cad609d9d55d469b76d556520fc943dc.jpg", TagID = "109", TagName = "新番推荐" }); } if (tags == null) { return; } foreach (var item in tags) { gridview.Items.Add(new Tags { Cover = item.Cover, TagID = item.TagID, TagName = item.TagName }); } }
private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { PivotItem item = (PivotItem)pivot.SelectedItem; string tag = item.Header.ToString(); if (tag == "评论" && listview.Items.Count == 0) { if (aid.Length > 0) { var text = Load.FindChildOfType <TextBlock>(listview); bool isDone = await load(1, aid); if (isDone && text != null) { text.Text = "评论装填完毕!"; } } else { // load(1,season_id) } } if (tag == "相关视频" && list_relates.Items.Count == 0) { if (aid.Length > 0) { list_relates.ItemsSource = await ContentServ.GetRelatesAsync(aid); } else { // load(1,season_id) } } }
protected async override void OnNavigatedTo(NavigationEventArgs e) { string url = "http://bangumi.bilibili.com/api/tags?appkey=85eb6835b0a1034e&build=424000&mobi_app=wp&platform=wp&page=1&pagesize=60&ts=1474645841127&sign="; string t = "appkey=85eb6835b0a1034e&build=424000&mobi_app=wp&platform=wp&page=1&pagesize=60&ts=1474645841127"; string[] argss = t.Split('&'); List <string> list = argss.ToList(); list.Sort(); StringBuilder stringBuilder = new StringBuilder(); foreach (string s in list) { stringBuilder.Append(stringBuilder.Length > 0 ? "&" : string.Empty); stringBuilder.Append(s); } string a = stringBuilder.ToString(); string b = "2ad42749773c441109bdc0191257a664"; string c = Secret.GetMD5(a + b); url += c; List <Tags> tags = await ContentServ.GetTagsAsync(url); if (tags != null && tags.Count > 0) { foreach (var item in tags) { gridview.Items.Add(new Tags { Cover = item.Cover, TagID = item.TagID, TagName = item.TagName }); } } }
private void GridView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { GridView gridview = sender as GridView; var scroll = Load.FindChildOfType <ScrollViewer>(gridview); var text = Load.FindChildOfType <TextBlock>(gridview); scroll.ViewChanged += async(s, a) => { if ((scroll.VerticalOffset >= scroll.ScrollableHeight - 50 || scroll.ScrollableHeight == 0) && !isLoading) { text.Visibility = Visibility.Visible; int count0 = gridview.Items.Count; int page = gridview.Items.Count / 20 + 1; isLoading = true; List <Content> temps = await ContentServ.GetContentAsync(int.Parse(gridview.Tag.ToString()), page); if (temps.Count == 0) { text.Text = "装填完毕!"; return; } text.Visibility = Visibility.Collapsed; foreach (var item in temps) { gridview.Items.Add(item); } isLoading = false; } }; }
protected async override void OnNavigatedTo(NavigationEventArgs e) { mid = e.Parameter.ToString(); user = await ContentServ.GetUserinfoAsync(mid); Face.ImageSource = new BitmapImage { UriSource = new Uri(user.Face) }; level.Source = new BitmapImage { UriSource = new Uri("ms-appx:///Assets//Others//lv" + user.Current_level + ".png", UriKind.Absolute) }; exp_current.Text = user.Current_exp; toutu.Source = new BitmapImage(new Uri("http://i0.hdslb.com/" + user.Toutu)); birth.Text += user.BirthDay; regdate.Text += user.RegTime; sex.Text += user.Sex; addr.Text += user.Place.Length > 0 ? user.Place : "未知"; if (user.Current_level == "6") { bar.Value = 100; } else { bar.Value = int.Parse(user.Current_exp); bar.Maximum = int.Parse(user.Next_exp); exp_total.Text = user.Next_exp; } userName.Text = user.Name; user.Sign = user.Sign; list_concern.ItemsSource = await ContentServ.GetFriendsAsync(mid);//以后得改 list_videos.ItemsSource = await ContentServ.GetMyVideoAsync(mid, 1); conlist.ItemsSource = await ContentServ.GetFriendsCons(mid, 1); }
async void load(string mid) { if (mid.Length == 0) { foreach (var item in await ContentServ.GetConAsync(1)) { conlist.Items.Add(item); conlist2.Items.Add(item); } } else { foreach (var item in await ContentServ.GetFriendsCons(mid, 1)) { conlist.Items.Add(item); conlist2.Items.Add(item); } } if (conlist.Items.Count < 20) { var text1 = Load.FindChildOfType <TextBlock>(conlist); text1.Text = "加载完毕!"; } con.Text += conlist.Items.Count == 0 ? "(暂无订阅)" : ""; isConcernLoad = true; }
async Task read(int index) { danmaku.ClearDanmu(); media.Visibility = Visibility.Collapsed; grid_status.Visibility = Visibility.Visible; cid = infos[index].Cid; aid = infos[0].Title; status.Text = "获取视频地址..."; URL = await ContentServ.GetVedioURL(cid, quality, format); status.Text += (URL == null) ? "失败" : $"{URL.Ps.Count}个{format}分段"; if (URL == null) { return; } status.Text += Environment.NewLine + "加载弹幕数据..."; try { DanmuPool = await GetDanmu(cid); } catch (Exception e) { status.Text += "失败" + e.Message; } if (format == VideoFormat.mp4) { // MP4只有一个分段(根据经验( ̄▽ ̄)") media.Source = new Uri(URL.Ps[0].Url); } else if (format == VideoFormat.flv) { // 先读第一个分段 SetFFmpegSource(URL.Ps[0].Url); } if (URL.Ps.Count > 1) { // Flag该立的时候也得立啊 // GetFlags(); } _currentP = URL.Ps[0]; txt_title.Text = infos[index].Title; if (URL.Acceptquality.Contains("1")) { q1.Visibility = Visibility.Visible; } if (URL.Acceptquality.Contains("2")) { q2.Visibility = Visibility.Visible; } if (URL.Acceptquality.Contains("3")) { q3.Visibility = Visibility.Visible; } status.Text += Environment.NewLine + "正在缓冲视频..."; loading.Visibility = Visibility.Visible; }
async Task LoadItem(GridView list, SearchType type) { try { if (list.Items.Count == 0 && !isLoading) { ArrayList items = new ArrayList(); switch (type) { case SearchType.Videos: var t1 = await ContentServ.GetSearchResultAsync(keyword, 1); foreach (var item in t1) { items.Add(item); } break; case SearchType.Animes: var t2 = await ContentServ.GetBangumisAsync(keyword, 1); foreach (var item in t2) { items.Add(item); } break; case SearchType.Ups: var t3 = await ContentServ.GetUpsAsync(keyword, 1); foreach (var item in t3) { items.Add(item); } break; } if (items == null) { return; } else if (list != null && items.Count > 0) { foreach (var item in items) { list.Items.Add(item); } } if (items.Count < 20) { var text = Load.FindChildOfType <TextBlock>(list); text.Text = "装填完毕!"; } } return; } catch { } }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); ReadyList.Visibility = Visibility.Visible; desc.Visibility = Visibility.Visible; aid = e.Parameter.ToString(); string url = "http://app.bilibili.com/x/view?_device=android&_ulv=10000&plat=0&build=424000&aid=" + aid + "&appkey=" + ApiHelper.appkey + "&access_key=" + ApiHelper.accesskey; url += ApiHelper.GetSign(url); details = await ContentServ.GetDetailsAsync(url); if (details != null) { pageNavi("AV" + details.Aid); BitmapImage bmp = new BitmapImage(); bmp.UriSource = new Uri(details.Pic); pic.Source = bmp; title.Text = details.Title; up.Content = details.Upzhu; desc.Text = details.Desc; count.Text = "播放:" + details.View + "\t" + "收藏:" + details.Fav + "\t" + "弹幕:" + details.Danmu + "\t" + "硬币:" + details.Coins + "\t" + "评论:" + details.Reply; time.Text = details.Time; if (details.IsFav == "1") { btn_addfav.Icon = new SymbolIcon(Symbol.UnFavorite); btn_addfav.Label = "取消收藏"; } foreach (var item in details.Tags) { if (item.Length > 0) { list_tags.Items.Add(new Tags { Tag = item }); } } foreach (var item in details.Ps) { ReadyList.Items.Add(item); } //if (UserHelper.concernList.FindIndex(o => o.ID == cid) != -1) //{ // btn_addfav.Icon = new SymbolIcon(Symbol.UnFavorite); // btn_addfav.Label = "取消收藏"; //} } else { messagepop.Show("视频不存在或已被删除"); } //if (UserHelper.favList.FindIndex(o => o.Num == aid) != -1) //{ // btn_addfav.Icon = new SymbolIcon(Symbol.UnFavorite); // btn_addfav.Label = "取消收藏"; //} }
private async void mainpivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { string tid = (mainpivot.SelectedItem as PivotItem).Tag.ToString(); GridView gridview = FindName("list" + tid) as GridView; if (gridview != null && gridview.Items.Count == 0) { gridview.ItemsSource = await ContentServ.GetRankItemsAsync(tid); } }
/// <summary> /// /// </summary> /// <param name="tid"></param> /// <param name="order"></param> /// <returns></returns> private async Task LoadItems(GridView gridview, int tid, int page) { //int count= List <Content> a = await ContentServ.GetContentAsync(tid, page, 6); if (a != null) { gridview.ItemsSource = a; } }
private async void cb_folder_SelectionChanged(object sender, SelectionChangedEventArgs e) { Folder folder = cb_folder.SelectedItem as Folder; txt_count.Text = folder.Count.ToString() + " / " + folder.MCount.ToString() + "\t创建时间:" + folder.Ctime; string fid = folder.Fid; //待加:增量加载 favlist.ItemsSource = await ContentServ.GetFavAsync(fid, 1, 20); }
async void load() { List <Folder> myFolder = await ContentServ.GetFavFolders(); foreach (var item in myFolder) { cb_folder.Items.Add(item); } cb_folder.SelectedIndex = 0; }
private async void mainpivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { switch (mainpivot.SelectedIndex) { case 0: { if (!IsChatLoaded) { List <Chat> chats = await ContentServ.GetChatsAsync(); ls_chat.ItemsSource = chats; IsChatLoaded = true; } } break; case 1: { if (!IsWissLoaded) { List <Wisper> wiss = await ContentServ.GetWisperAsync(); ls_wiss.ItemsSource = wiss; IsWissLoaded = true; } } break; case 2: { if (!IsNotiLoaded) { List <Notify> notis = await ContentServ.GetNotiAsync(); ls_noti.ItemsSource = notis; IsNotiLoaded = true; } } break; case 3: { if (!PraiseLoaded) { List <PraiseMe> notis = await ContentServ.GetPraiseListAsync(); ls_prme.ItemsSource = notis; PraiseLoaded = true; } } break; } }
private async void Random_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) { int aid = 0; Details details = new Details(); do { aid = new Random().Next(10000, 5000000); string a = "http://app.bilibili.com/x/view?_device=android&_ulv=10000&plat=0&build=424000&aid="; details = await ContentServ.GetDetailsAsync(a + aid); } while (details == null); Frame.Navigate(typeof(Detail_P), aid); }
private async Task LoadItems(int tid, int page) { GridView gridview = FindName("gridview" + tid) as GridView; if (gridview != null) { List <Content> a = await ContentServ.GetContentAsync(tid, page, size); if (a != null) { gridview.ItemsSource = a; } } }
private async Task loadStatus() { // http://message.bilibili.com/api/notify/query.replyme.list.do?captcha=e91dd48f73e11db1cc7c3b729865e572&data_type=1 Count count = await ContentServ.GetCountAsync(); if (count != null) { h0.Text += count.Reply_me == "0" ? string.Empty : count.Reply_me; h1.Text += count.Chat_me == "0" ? string.Empty : count.Chat_me; h2.Text += count.Notify_me == "0" ? string.Empty : count.Notify_me; int a = int.Parse(count.At_me) + int.Parse(count.Praise_me); h3.Text += a == 0 ? string.Empty : a.ToString(); } }
/// <summary> /// 开始下载 /// </summary> private async void Btn_ok_Click(object sender, RoutedEventArgs e) { int i = 0; flyout_download.Hide(); foreach (Pages item in ReadyList.SelectedItems) { try { cid = item.Cid; VideoURL url = await ContentServ.GetVedioURL(cid, quality, format); string name = StringDeal.RemoveSpecial(title.Text); string part = StringDeal.RemoveSpecial(item.Part); StorageFolder folder = await DownloadHelper.GetMyFolderAsync(); StorageFolder f1 = await folder.CreateFolderAsync(name, CreationCollisionOption.OpenIfExists); List <DownloadOperation> list = new List <DownloadOperation>(); for (int j = 0; j < url.Ps.Count; j++) { list.Add(await DownloadHelper.Download(url.Ps[j].Url, $"{part}_{j}.{format.ToString()}", f1)); } // 如果await,那么执行完第一个StartAsync()后即退出循环.GetCurrentDownloadsAsync()方法同样会遇到此问题.(Download页) IAsyncOperationWithProgress <DownloadOperation, DownloadOperation> start; for (int k = 0; k < list.Count; k++) { start = list[k].StartAsync(); } i++; await DownloadHelper.AddVideoInfo(part, cid, details.Sid); await popup.Show(i.ToString() + "个视频已加入下载队列"); if (SettingHelper.ContainsKey("_downdanmu")) { if ((bool)SettingHelper.GetValue("_downdanmu") == false) { continue; } } await DownloadHelper.DownloadDanmakuAsync(cid, part, f1); } catch (Exception err) { await popup.Show(err.Message); } } SwitchCommandBar(false); }
private async void mainpivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { TextBlock txt = this.FindName(string.Format("h{0}", mainpivot.SelectedIndex)) as TextBlock; for (int i = 0; i < mainpivot.Items.Count; i++) { TextBlock temp = this.FindName(string.Format("h{0}", i)) as TextBlock; temp.Foreground = new SolidColorBrush(Colors.LightGray); } txt.Foreground = new SolidColorBrush(Colors.White); switch (mainpivot.SelectedIndex) { case 0: { if (!IsChatLoaded) { List <Chat> chats = await ContentServ.GetChatsAsync(); ls_chat.ItemsSource = chats; IsChatLoaded = true; } } break; case 1: { if (!IsWissLoaded) { List <Wisper> wiss = await ContentServ.GetWisperAsync(); ls_wiss.ItemsSource = wiss; IsWissLoaded = true; } } break; case 2: { if (!IsNotiLoaded) { List <Notify> notis = await ContentServ.GetNotiAsync(); ls_noti.ItemsSource = notis; IsNotiLoaded = true; } } break; } }
async Task loadpulls(int page) { isloadingpull = true; List <Pulls> list = await ContentServ.GetPullsAsync(page); foreach (var item in list) { list_pull.Items.Add(item); } if (list.Count < 20) { list_pull.ContainerContentChanging -= list_pull_ContainerContentChanging; isPullLoadingDone = true; } isloadingpull = false; }
// 0:公开 private async void cb_folder_SelectionChanged(object sender, SelectionChangedEventArgs e) { folder = cb_folder.SelectedItem as Folder; if (folder != null) { name = folder.Name; togpublic.Toggled -= togpublic_Toggled; togpublic.IsOn = folder.State == "0" || folder.State == "2" ? true : false; togpublic.Toggled += togpublic_Toggled; fid = folder.Fid; txt_count.Text = folder.Count.ToString() + " / " + folder.MCount.ToString() + "\t创建时间:" + folder.Ctime; // 待加:增量加载 favlist.ItemsSource = await ContentServ.GetFavAsync(fid, 1, 20); return; } }
//番剧推荐 async Task <bool> addcomment(string p) { string url = "http://bangumi.bilibili.com/api/bangumi_recommend?appkey=" + ApiHelper.appkey + "&build=427000&cursor=" + p + "&pagesize=10&platform=android&ts=" + ApiHelper.GetLinuxTS().ToString(); url += ApiHelper.GetSign(url); List <HotBangumi> MyList = await ContentServ.GetHotBangumiAsync(url); if (MyList.Count < 1) { return(false); } foreach (var item in MyList) { list_commandbangumi.Items.Add(item); } return(true); }
async Task Load(int page) { string url = "http://bangumi.bilibili.com/api/get_season_by_tag_v2?_device=android&appkey=85eb6835b0a1034e&build=424000&indexType=0&page=" + page.ToString() + "&pagesize=40&platform=wp&tag_id=" + id + "&ts=1474645896189&sign="; url += ApiHelper.GetSign(url); List <Models.Bangumi> list_rs = new List <Models.Bangumi>(); list_rs = await ContentServ.GetBansByTagAsync(url); if (list_rs != null && list_rs.Count > 0) { foreach (var item in list_rs) { listview.Items.Add(item); } } }
private async void Random_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) { if (!WebStatusHelper.IsOnline()) { Report("没有网络连接"); return; } int aid = 0; Details details = new Details(); do { aid = new Random().Next(10000, 5000000); string a = "http://app.bilibili.com/x/view?_device=android&_ulv=10000&plat=0&build=424000&aid="; details = await ContentServ.GetDetailsAsync(a + aid, true); } while (details == null || details.Aid == null); Frame.Navigate(typeof(Detail_P), aid); }
private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { int index = pivot.SelectedIndex; GridView gridview = FindName("gridview" + index.ToString()) as GridView; if (gridview.Items.Count == 0) { var temp = await ContentServ.GetVideosAsync(int.Parse(gridview.Tag.ToString()), 1); if (temp != null) { foreach (var item in temp) { gridview.Items.Add(item); } } } }
private void GridView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { GridView gridview = sender as GridView; var scroll = Load.FindChildOfType <ScrollViewer>(gridview); scroll.ViewChanged += async(s, a) => { if ((scroll.VerticalOffset >= scroll.ScrollableHeight - 50 || scroll.ScrollableHeight == 0) && !isLoading) { int count0 = gridview.Items.Count; int page = gridview.Items.Count / 20 + 1; isLoading = true; if (gridview.Tag.ToString() == "0") { var temps = await ContentServ.GetTopicListAsync(page); if (temps.Count == 0) { return; } foreach (var item in temps) { gridview.Items.Add(item); } isLoading = false; } else { var temps = await ContentServ.GetEventListAsync(page); if (temps.Count == 0) { return; } foreach (var item in temps) { gridview.Items.Add(item); } isLoading = false; } } }; }
async Task <bool> load(int page, string aid) { string url = "http://api.bilibili.com/x/reply?_device=wp&_ulv=10000&build=424000&platform=android&appkey=" + ApiHelper.appkey + "&oid=" + aid + "&sort=0&type=1&pn=" + page.ToString() + "&ps=20"; url += ApiHelper.GetSign(url); List <Reply> replys = new List <Reply>(); replys = await ContentServ.GetReplysAsync(url); foreach (var item in replys) { listview.Items.Add(item); } if (replys.Count < 20) { return(true); } return(false); }
// http://api.bilibili.com/x/v2/history?_device=android&_hwid=ccbb856c97ccb8d2&_ulv=10000&access_key=a48208a7c5b67a4a369124cf5c1b515c&appkey=1d8b6e7d45233436&build=427000&mobi_app=android&platform=android&pn=1&ps=200 async Task load(int p) { try { string url = "http://api.bilibili.com/x/v2/history?_device=wp&_ulv=10000&access_key=" + ApiHelper.accesskey + "&appkey=" + ApiHelper.appkey + "&build=427000&platform=android&pn=" + p.ToString() + "&ps=20"; url += ApiHelper.GetSign(url); List <Models.History> hs = await ContentServ.GetHistoryAsync(url); foreach (var item in hs) { hslist.Items.Add(item); } if (hs.Count < 20) { var text = Load.FindChildOfType <TextBlock>(hslist); text.Text = "没有更多历史项"; hslist.ContainerContentChanging -= hslist_ContainerContentChanging; } } catch { } }