Пример #1
0
        private async void LoadEp()
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;
                loading            = true;
                if (pageN == 1)
                {
                    list_E.Items.Clear();
                }
                string uri = "";

                uri = "https://picaapi.picacomic.com/comics/" + _id + "/eps?page=" + pageN;

                string results = await WebClientClass.GetResults(new Uri(uri));

                EpsModel info = JsonConvert.DeserializeObject <EpsModel>(results);

                if (info.code == 200)
                {
                    if (info.data.eps.docs.Count != 0)
                    {
                        info.data.eps.docs.ForEach(x => list_E.Items.Add(x));
                        pageN++;
                    }
                    else
                    {
                        messShow.Show("沒有更多了", 2000);
                        btn_LoadMore.Visibility = Visibility.Collapsed;
                    }
                }
                else
                {
                    messShow.Show(info.message, 2000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867)
                {
                    messShow.Show("檢查你的網絡連接!", 3000);
                }
                else
                {
                    messShow.Show("讀取信息失敗了,挂個VPN試試?", 3000);
                }
            }
            finally
            {
                loading            = false;
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }