private async void LoadData() { try { pr_Load.Visibility = Visibility.Visible; string url = string.Format("http://live.bilibili.com/appUser/myTitleList?access_key={0}&appkey={1}&build=433000&platform=wp&scale=xxhdpi", ApiHelper.access_key, ApiHelper._appKey); url += "&sign=" + ApiHelper.GetSign(url); string results = await WebClientClass.GetResults(new Uri(url)); LiveTitleModel m = JsonConvert.DeserializeObject <LiveTitleModel>(results); if (m.code == 0) { if (m.data.list.Count == 0) { NoDT.Visibility = Visibility.Visible; } else { NoDT.Visibility = Visibility.Collapsed; } list.ItemsSource = m.data.list; } else { messShow.Show(m.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; } }
private async void LoadData() { try { pr_Load.Visibility = Visibility.Visible; string url = $"https://api.live.bilibili.com/appUser/myTitleList?access_key={ApiHelper.access_key}&actionKey=appkey&appkey={ApiHelper.AndroidKey.Appkey}&build={ApiHelper.build}&device=android&mobi_app=android&platform=android&scale=hdpi&ts={ApiHelper.GetTimeSpan}"; url += "&sign=" + ApiHelper.GetSign(url); string results = await WebClientClass.GetResults(new Uri(url)); LiveTitleModel m = JsonConvert.DeserializeObject <LiveTitleModel>(results); if (m.code == 0) { if (m.data.list.Count == 0) { NoDT.Visibility = Visibility.Visible; } else { NoDT.Visibility = Visibility.Collapsed; } list.ItemsSource = m.data.list; } 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 { pr_Load.Visibility = Visibility.Collapsed; } }