Ejemplo n.º 1
0
        public async void LoadComment_Reply(string aid)
        {
            try
            {
                _Loading_Reply     = true;
                pr_load.Visibility = Visibility.Visible;


                string url = "http://api.bilibili.com/x/reply/reply?oid=" + aid + "&pn=" + pageNum_Reply + "&ps=20&root=" + rpid + "&type=1&access_key=" + ApiHelper.access_key + "&appkey=" + ApiHelper.AndroidKey.Appkey + "&rnd" + new Random().Next(1, 9999);;
                url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResults(new Uri(url));

                NewCommentModel model = JsonConvert.DeserializeObject <NewCommentModel>(results);
                if (model.code == 0)
                {
                    if (pageNum_Reply == 1)
                    {
                        ListView_Comment_Reply.Items.Clear();
                    }
                    if (model.data.replies.Count != 0)
                    {
                        model.data.replies.ForEach(x => ListView_Comment_Reply.Items.Add(x));
                        pageNum_Reply++;
                    }
                    else
                    {
                        Utils.ShowMessageToast("加载完了...", 3000);
                    }
                }
                else
                {
                    Utils.ShowMessageToast(model.message, 3000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867)
                {
                    Utils.ShowMessageToast("检查你的网络连接!", 3000);
                }
                else
                {
                    Utils.ShowMessageToast("读取评论失败!\r\n" + ex.Message, 3000);
                }
            }
            finally
            {
                pr_load.Visibility = Visibility.Collapsed;
                _Loading_Reply     = false;
            }
        }
Ejemplo n.º 2
0
        public async void LoadComment()
        {
            try
            {
                GetEmojis();
                _Loading           = true;
                pr_load.Visibility = Visibility.Visible;
                string url = "http://api.bilibili.com/x/reply?type=1&sort=0&oid=" + _aid + "&pn=" + pageNum + "&ps=20&platform=wp&appkey=" + ApiHelper._appKey + "&access_key=" + ApiHelper.access_key + "&rnd" + new Random().Next(1, 9999);
                url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResults(new Uri(url));

                NewCommentModel model = JsonConvert.DeserializeObject <NewCommentModel>(results);
                if (model.code == 0)
                {
                    if (pageNum == 1)
                    {
                        ListView_Comment_Hot.ItemsSource = model.data.hots;
                        ListView_Comment_New.Items.Clear();
                    }
                    if (model.data.replies.Count != 0)
                    {
                        model.data.replies.ForEach(x => ListView_Comment_New.Items.Add(x));
                        pageNum++;
                    }
                    else
                    {
                        messShow.Show("加载完了...", 3000);
                    }
                }
                else
                {
                    messShow.Show(model.message, 3000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867)
                {
                    messShow.Show("检查你的网络连接!", 3000);
                }
                else
                {
                    messShow.Show("读取评论失败!\r\n" + ex.Message, 3000);
                }
            }
            finally
            {
                pr_load.Visibility = Visibility.Collapsed;
                _Loading           = false;
            }
        }
Ejemplo n.º 3
0
        public async void LoadHotComment(string aid)
        {
            try
            {
                pr_load.Visibility = Visibility.Visible;

                string url = "http://api.bilibili.com/x/reply?type=1&sort=1&oid=" + aid + "&pn=1&ps=20&platform=wp&appkey=" + ApiHelper.AndroidKey.Appkey + "&access_key=" + ApiHelper.access_key + "&rnd" + new Random().Next(1, 9999);;
                url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResults(new Uri(url));

                NewCommentModel model = JsonConvert.DeserializeObject <NewCommentModel>(results);
                if (model.data.replies.Count != 0)
                {
                    model.data.replies.ForEach(x => ls_Hot.Items.Add(x));
                }
                else
                {
                    Utils.ShowMessageToast("加载完了...", 3000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867)
                {
                    Utils.ShowMessageToast("检查你的网络连接!", 3000);
                }
                else
                {
                    Utils.ShowMessageToast("读取热门评论失败!\r\n" + ex.Message, 3000);
                }
            }
            finally
            {
                pr_load.Visibility = Visibility.Collapsed;
            }
        }