/// <summary> /// 收藏 /// </summary> private async void Addfav_Click(object sender, RoutedEventArgs e) { if (ApiHelper.IsLogin()) { if (btn_addfav.Label == "收藏") { AddFav addfavDialog = new AddFav(); await addfavDialog.ShowAsync(); if (addfavDialog.Tag != null) { if (addfavDialog.Tag.GetType() == typeof(List <string>)) { List <string> fids = addfavDialog.Tag as List <string>; foreach (var fid in fids) { string url = "http://api.bilibili.com/x/app/favourite/video/add?_device=wp&_ulv=10000&build=424000&platform=android&fid=" + fid + "&appkey=" + ApiHelper.appkey + "&access_key=" + ApiHelper.accesskey; url += ApiHelper.GetSign(url); string result = await BaseService.SendPostAsync(url, "aid=" + aid); JsonObject json = JsonObject.Parse(result); if (json.ContainsKey("code")) { if (json["code"].ToString() == "0") { btn_addfav.Icon = new SymbolIcon(Symbol.UnFavorite); btn_addfav.Label = "取消收藏"; } else { await popup.Show("收藏失败!" + json["message"].ToString()); } } } } } } else if (btn_addfav.Label == "取消收藏") { string url = "http://api.bilibili.com/x/favourite/video/del?_device=android&_ulv=10000&platform=android&build=427000&appkey=" + ApiHelper.appkey + "&access_key=" + ApiHelper.accesskey; url += ApiHelper.GetSign(url); string result = await BaseService.SendPostAsync(url, "aid=" + aid); JsonObject json = JsonObject.Parse(result); if (json.ContainsKey("code")) { if (json["code"].ToString() == "0") { btn_addfav.Icon = new SymbolIcon(Symbol.Add); btn_addfav.Label = "收藏"; } else { await popup.Show("取消收藏失败!" + json["message"].ToString()); } } } } }
public PlayVideo() { this.InitializeComponent(); this._addFav = new AddFav(); this.TxtChannelName.set_Text(PlayVideo.ChanelPlayer.ChanelName); this.LoadImageFav(); this.LoadLichChieu(); }