private async void GetData() { string doctorUrl = "http://dxy.com/app/i/columns/article/list?page_index=" + pageIndex + "&items_per_page=10&order=publishTime&author_id=" + doc_id; HttpClient client = new HttpClient(); HttpResponseMessage response = await client.GetAsync(doctorUrl); string responseBody = await response.Content.ReadAsStringAsync(); string tmp = responseBody.Substring(8, responseBody.Length - 9); newDetail n = JsonConvert.DeserializeObject <newDetail>(tmp); if (pageIndex == 1) { BitmapImage img = new BitmapImage(new Uri(n.Items.FirstOrDefault().Author_avatar, UriKind.Absolute)); docImg.Source = img; docName.Text = n.Items.FirstOrDefault().Author; docIntroduction.Text = n.Items.FirstOrDefault().Author_remarks; } if (n.Items.Count < 10) { morePro.Visibility = Visibility.Collapsed; } n.Items.ForEach(a => { bindList.Add(a); }); loading.Visibility = Visibility.Collapsed; }
/// <summary> /// 页面加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { if (NavigationContext.QueryString.Keys.Contains("id")) { string i = NavigationContext.QueryString["id"]; string url = "http://dxy.com/app/i/columns/article/single?id=" + i; HttpResponseMessage response = await client.GetAsync(url); string responseBody = await response.Content.ReadAsStringAsync(); string tmp = responseBody.Substring(8, responseBody.Length - 9); news = JsonConvert.DeserializeObject <newDetail>(tmp); var tmpRes = news.Items.First(); titleTb.Text = tmpRes.Title; doctorName.Text = tmpRes.Author; doc_id = tmpRes.Author_id; linkImgUrl = tmpRes.Cover_small; linkTitle = tmpRes.Title; string tmpContent = ConvertExtendedASCII(tmpRes.Content); conWb.NavigateToString(tmpContent); saveContent = tmpContent; } //邀请评价 if (!settings.Contains("hasReviewed")) { OpenTitleStoryboard.Begin(); } }