Example #1
0
        private async void GetPutCoin()
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;
                WebClientClass wc = new WebClientClass();
                txt_Load_Coin.IsEnabled = false;
                txt_Load_Coin.Content   = "加载中...";
                string results = await wc.GetResults(new Uri("http://space.bilibili.com/ajax/member/getCoinVideos?mid=" + Uid + "&pagesize=100" + page + "&rnd=" + new Random().Next(1, 9999)));

                //一层
                GetUserSubmit model1 = JsonConvert.DeserializeObject <GetUserSubmit>(results);
                //二层
                GetUserSubmit model2 = JsonConvert.DeserializeObject <GetUserSubmit>(model1.data.ToString());
                //三层
                List <GetUserSubmit> lsModel = JsonConvert.DeserializeObject <List <GetUserSubmit> >(model2.list.ToString());
                list_ACoin.ItemsSource  = lsModel;
                txt_Load_Coin.IsEnabled = false;
                txt_Load_Coin.Content   = "加载完了...";
            }
            catch (Exception)
            {
            }
            finally
            {
                if (list_ACoin.Items.Count == 0)
                {
                    txt_Load_Coin.IsEnabled = false;
                    txt_Load_Coin.Content   = "没有投币...";
                }
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
        private async Task GetSubInfo()
        {
            try
            {
                user_GridView_Submit.ItemsSource = null;
                WebClientClass wc = new WebClientClass();
                txt_Load.IsEnabled = false;
                txt_Load.Content   = "加载中...";
                string results = await wc.GetResults(new Uri("http://space.bilibili.com/ajax/member/getSubmitVideos?mid=" + Uid + "&pagesize=20&page=1"));

                //一层
                GetUserSubmit model1 = JsonConvert.DeserializeObject <GetUserSubmit>(results);
                //二层
                GetUserSubmit model2 = JsonConvert.DeserializeObject <GetUserSubmit>(model1.data.ToString());
                //三层
                List <GetUserSubmit> lsModel = JsonConvert.DeserializeObject <List <GetUserSubmit> >(model2.vlist.ToString());
                user_GridView_Submit.ItemsSource = lsModel;
            }
            catch (Exception)
            {
            }
            finally
            {
                if (user_GridView_Submit.Items.Count == 0)
                {
                    DT_SUB.Visibility = Visibility.Visible;
                }
                else
                {
                    DT_SUB.Visibility = Visibility.Collapsed;
                }
            }
        }
Example #3
0
        private async Task GetSubInfo(string uid)
        {
            try
            {
                pr_Load.Visibility        = Visibility.Visible;
                btn_More_Video.Visibility = Visibility.Collapsed;
                string results = await WebClientClass.GetResults(new Uri("http://space.bilibili.com/ajax/member/getSubmitVideos?mid=" + uid + "&pagesize=30" + "&page=" + getPage));

                //一层
                GetUserSubmit model1 = JsonConvert.DeserializeObject <GetUserSubmit>(results);
                //二层
                GetUserSubmit model2 = JsonConvert.DeserializeObject <GetUserSubmit>(model1.data.ToString());
                //三层
                List <GetUserSubmit> lsModel = JsonConvert.DeserializeObject <List <GetUserSubmit> >(model2.vlist.ToString());
                if (lsModel.Count != 0)
                {
                    foreach (GetUserSubmit item in lsModel)
                    {
                        list_ASubit.Items.Add(item);
                    }
                    getPage++;
                }
                else
                {
                    Utils.ShowMessageToast("加载完了", 3000);
                }
            }
            catch (Exception)
            {
                Utils.ShowMessageToast("加载投稿失败", 3000);
            }
            finally
            {
                btn_More_Video.Visibility = Visibility.Visible;
                pr_Load.Visibility        = Visibility.Collapsed;
                if (list_ASubit.Items.Count == 0)
                {
                    Utils.ShowMessageToast("没有投稿", 3000);
                    btn_More_Video.Visibility = Visibility.Collapsed;
                }
            }
        }
        private async Task GetSubInfo(int page, string uid)
        {
            try
            {
                pr_Load_ASubit.Visibility = Visibility.Visible;
                WebClientClass wc = new WebClientClass();
                txt_Load.IsEnabled = false;
                txt_Load.Content   = "加载中...";
                string results = await wc.GetResults(new Uri("http://space.bilibili.com/ajax/member/getSubmitVideos?mid=" + uid + "&pagesize=20" + "&page=" + page));

                //一层
                GetUserSubmit model1 = JsonConvert.DeserializeObject <GetUserSubmit>(results);
                //二层
                GetUserSubmit model2 = JsonConvert.DeserializeObject <GetUserSubmit>(model1.data.ToString());
                //三层
                List <GetUserSubmit> lsModel = JsonConvert.DeserializeObject <List <GetUserSubmit> >(model2.vlist.ToString());
                foreach (GetUserSubmit item in lsModel)
                {
                    list_ASubit.Items.Add(item);
                }

                getPage++;
                if (model2.pages < getPage)
                {
                    txt_Load.IsEnabled = false;
                    txt_Load.Content   = "加载完了...";
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                if (list_ASubit.Items.Count == 0)
                {
                    txt_Load.IsEnabled = false;
                    txt_Load.Content   = "没有投稿...";
                }
                pr_Load_ASubit.Visibility = Visibility.Collapsed;
            }
        }