示例#1
0
        private async void GetTJ()
        {
            try
            {
                _TJLoading         = true;
                pr_Load.Visibility = Visibility.Visible;


                string url = string.Format("http://live.bilibili.com/mobile/rooms?access_key={0}&appkey={1}&area_id={2}&build=434000&mobi_app=android&page={3}&platform=android&sort={4}", ApiHelper.access_key, ApiHelper._appKey_Android, _pid, _TJPage, _sort);
                if (grid_tag.SelectedIndex != 0 && grid_tag.SelectedIndex != -1)
                {
                    url += "&tag=" + Uri.EscapeDataString((grid_tag.SelectedItem as LivePartTagModel).tag_name);
                }
                url += "&sign=" + ApiHelper.GetSign_Android(url);
                string results = await WebClientClass.GetResults(new Uri(url));

                AllLiveModel m = JsonConvert.DeserializeObject <AllLiveModel>(results);
                if (m.code == 0)
                {
                    if (m.data.Count != 0)
                    {
                        m.data.ForEach(x => gv.Items.Add(x));
                        _TJPage++;
                    }
                    else
                    {
                        Utils.ShowMessageToast("加载完了...", 3000);
                    }
                }
                else
                {
                    Utils.ShowMessageToast(m.message, 3000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867)
                {
                    Utils.ShowMessageToast("检查你的网络连接!", 3000);
                }
                else
                {
                    Utils.ShowMessageToast("发生错误\r\n" + ex.Message, 3000);
                }
            }
            finally
            {
                _TJLoading         = false;
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
示例#2
0
        private async void GetLB()
        {
            try
            {
                if (_LBPage == 1)
                {
                    gv_LB.Items.Clear();
                }
                _LBLoading         = true;
                pr_Load.Visibility = Visibility.Visible;

                string url = string.Format("http://live.bilibili.com/mobile/rooms?access_key={0}&appkey={1}&area_id=0&build=434000&mobi_app=android&page={2}&platform=android&sort=roundroom", ApiHelper.access_key, ApiHelper._appKey_Android, _LBPage);
                url += "&sign=" + ApiHelper.GetSign_Android(url);
                string results = await WebClientClass.GetResults(new Uri(url));

                AllLiveModel m = JsonConvert.DeserializeObject <AllLiveModel>(results);
                if (m.code == 0)
                {
                    if (m.data.Count != 0)
                    {
                        m.data.ForEach(x => gv_LB.Items.Add(x));
                        _LBPage++;
                    }
                    else
                    {
                        Utils.ShowMessageToast("加载完了...", 3000);
                    }
                }
                else
                {
                    Utils.ShowMessageToast(m.message, 3000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867)
                {
                    Utils.ShowMessageToast("检查你的网络连接!", 3000);
                }
                else
                {
                    Utils.ShowMessageToast("发生错误\r\n" + ex.Message, 3000);
                }
            }
            finally
            {
                _LBLoading         = false;
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }