public void GetTotal_Completed(object sender, DownloadStringCompletedEventArgs e) { try { if (e.Error != null) { throw new Exception(e.Error.Message); } var o = XDocument.Parse(e.Result); if (o.Root.Element("status_code").Value == "200") { foreach (var v in o.Descendants("content")) { ProgramDetailItem item = new ProgramDetailItem(); item.content_id = v.Element("content_id").Value; item.title = v.Element("title").Value; item.thumbnail = v.Element("thumbnail").Value; item.description = v.Element("description").Value; item.chapter_total = v.Element("chapter_total").Value; item.view = v.Element("view").Value; ProgramDetailList.Add(item); } } else { throw new Exception("code is " + o.Root.Element("status_code").Value); } } catch (Exception ex) { Debug.WriteLine("ShotDaraDetail.xaml.cs : GetTotal_Completed ; " + ex.Message); this.NavigationService.GoBack(); NavigationService.Navigate(new Uri("/ShotDaraDetail.xaml?Refresh=true", UriKind.Relative)); } HideProgressIndicator(); }
public void GetTotal_Completed(object sender, DownloadStringCompletedEventArgs e) { try { if (e.Error != null) { throw new Exception(e.Error.Message); } XDocument o = XDocument.Parse(e.Result, LoadOptions.None); if (o.Root.Element("status_code").Value == "200") { foreach (var v in o.Descendants("content")) { programDetailItem = new ProgramDetailItem(); programDetailItem.content_id = v.Element("content_id").Value; programDetailItem.title = v.Element("title").Value; programDetailItem.description = v.Element("description").Value; programDetailItem.thumbnail = v.Element("thumbnail").Value; programDetailItem.embed_code = v.Element("embed_code").Value; programDetailItem.view = v.Element("view").Value; ChapterlList.Add(programDetailItem); } textHead.Text = programDetailItem.title; viewnum.Text = programDetailItem.view; descriptionLabel.Visibility = Visibility.Visible; descriptionLabel.NavigateToString(eNewsDetailPage.StripTagsRegex(programDetailItem.embed_code)); } else { throw new Exception("code is " + o.Root.Element("status_code").Value); } } catch (Exception ex) { Debug.WriteLine("ProgramDetailPage.xaml.cs : GetTotal_Completed ; " + ex.Message); this.NavigationService.GoBack(); NavigationService.Navigate(new Uri("/MainPage.xaml?Refresh=true", UriKind.Relative)); } finally { HideProgressIndicator(); } }