private void Question_1_Click(object sender, RoutedEventArgs e) { try { string title = titleBox.Text; listDoc = client.FindArticles(title); MessageBox.Show("Successfully find " + listDoc.Count + " articles"); List <string> cites = new List <string>(); for (int i = 0; i < listDoc.Count; i++) { if (listDoc[i].cites != null) { for (int j = 0; j < listDoc[i].cites.Count; j++) { string fgbhsghlisehgmroseighielshgsielg = listDoc[i].title; cites.Add(listDoc[i].cites[j]); // listBoxVueArticle.Items.Add(list[i].cites[j]); } } } if (cites.Count <= 0) { MessageBox.Show("No citation for the articles"); } int count = 0; //var dico = client.FindAllTitlesById(); for (int i = 0; i < cites.Count; i++) { DocMongo curDoc = client.FindById(cites[i]); if (curDoc != null && curDoc.title != null) { count++; listBoxVueArticle.Items.Add(cites[i] + " : " + curDoc.title + "(" + ((curDoc.authors != null) ? curDoc.authors[0] : "no authors") + ")"); if (count == 10) { break; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public string formatItem(DocMongo doc) { string authors = ""; for (int j = 0; j < doc.authors.Count; j++) { authors += doc.authors[j] + ", "; } if (authors.Length > 0) { authors = authors.Substring(0, authors.Length - 2); } string pages = ""; if (doc.pages != null && !(doc.pages is string)) { pages += ((ExpandoObject)doc.pages).First().Value + " - " + ((ExpandoObject)doc.pages).First().Value; } string line = String.Format("{0} ({1}): [{2}], publisher:{3}, type:{4}, pages:{5}", doc.title, doc.year, authors, doc.publisher, doc.type, pages); return(line); }
public string formatItem(DocMongo doc) { string authors = ""; for (int j = 0; j < doc.authors.Count; j++) authors += doc.authors[j] + ", "; if (authors.Length > 0) authors = authors.Substring(0, authors.Length - 2); string pages = ""; if (doc.pages != null && !(doc.pages is string)) { pages += ((ExpandoObject)doc.pages).First().Value + " - " + ((ExpandoObject)doc.pages).First().Value; } string line = String.Format("{0} ({1}): [{2}], publisher:{3}, type:{4}, pages:{5}", doc.title, doc.year, authors, doc.publisher, doc.type, pages); return line; }