private void EasyListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { EasyListBox lb = sender as EasyListBox; if (lb.SelectedIndex != -1) { Mention item = lb.SelectedItem as Mention; StaticData.acitem = new ACItem(item.title, item.href, item.dis, item.time, item.name, item.beizhu); NavigationService.Navigate(new Uri("/CommentPage.xaml", UriKind.RelativeOrAbsolute)); } lb.SelectedIndex = -1; }
private async Task getList() { islistbusy = true; indicator.IsVisible = true; try { using (Stream stream = await new HttpHelp().Get(string.Format(StaticData.mention, page))) { StreamReader sr = new StreamReader(stream); JObject obj = JObject.Parse(sr.ReadToEnd()); if (!(bool)obj["success"]) { if ((string)obj["message"] != null) { MessageBox.Show((string)obj["message"]); } indicator.IsVisible = false; return; } int totalPage = (int)obj["totalPage"]; if (page < totalPage) { page++; } else { page = 0; } List <int> commentList = new List <int>(); List <ACItem> contentList = new List <ACItem>(); foreach (var commentid in (obj["commentList"] as JArray)) { commentList.Add((int)commentid); } foreach (var content in (obj["contentList"] as JArray)) { contentList.Add(new ACItem((string)content["title"], (string)content["url"], (string)content["comments"], TimeFuc.getTime((long)content["releaseDate"]).ToString(), (string)content["username"], (string)content["description"])); } foreach (var item in obj["commentContentArr"].Values()) { if (!commentContentArr.ContainsKey(item.ToObject <comment>().cid)) { commentContentArr.Add(item.ToObject <comment>().cid, item.ToObject <comment>()); } } if (commentList.Count > 0) { for (int i = 0; i < commentList.Count; i++) { try { Mention item = new Mention(); item.title = contentList[i].title; item.href = contentList[i].href; item.dis = contentList[i].dis; item.time = contentList[i].time; item.name = contentList[i].name; item.beizhu = contentList[i].beizhu; comment comment = commentContentArr[commentList[i]]; item.content = comment.content; item.userName = comment.userName; item.postDate = comment.postDate; item.userImg = comment.userImg; item.count = comment.count; if (comment.quoteId != 0) { comment pcomment = commentContentArr[comment.quoteId]; item.pcontent = pcomment.content; item.puserName = pcomment.userName; item.ppostDate = pcomment.postDate; item.pcount = pcomment.count; } MentionList.Add(item); } catch { } } } } } catch { } islistbusy = false; indicator.IsVisible = false; }