Example #1
0
        private async void gv_like_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                var    info    = e.ClickedItem as LikeTagsModel;
                string results = await WebClientClass.PostResults(new Uri("http://api.bilibili.com/x/tag/subscribe/add"), "jsonp=jsonp&tag_id=" + info.tag_id, "http://www.bilibili.com/");

                JObject obj = JObject.Parse(results);
                if ((int)obj["code"] == 0)
                {
                    Utils.ShowMessageToast("订阅成功", 3000);
                    MyTagModel m = new MyTagModel()
                    {
                        tag_id = info.tag_id, name = info.tag_name
                    };
                    gv_like.Items.Remove(e.ClickedItem);
                    gv.Items.Add(m);
                }
                else
                {
                    Utils.ShowMessageToast(obj["message"].ToString(), 3000);
                }
            }
            catch (Exception)
            {
                Utils.ShowMessageToast("订阅失败", 3000);
            }
        }
Example #2
0
        private async void GetTag()
        {
            try
            {
                gv.Items.Clear();
                pr_Load.Visibility = Visibility.Visible;
                string results = await WebClientClass.GetResults(new Uri("http://space.bilibili.com/ajax/tags/getSubList?mid=" + ApiHelper.GetUserId()));

                MyTagModel my = JsonConvert.DeserializeObject <MyTagModel>(results);
                if (my.status)
                {
                    my.data.tags.ForEach(x => gv.Items.Add(x));
                    // gv.ItemsSource = my.data.tags;
                }
                else
                {
                    Utils.ShowMessageToast("读取失败 " + my.message, 3000);
                }
            }
            catch (Exception ex)
            {
                Utils.ShowMessageToast("读取失败 \r\n" + ex.Message, 3000);
            }
            finally
            {
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }