public void setResult(ResultList resultList) { this.ResultsPane.Items.Clear(); firstSearchFlag = 1; if (newResultFlag == 1 && resultList != null) { btnAddFav.IsEnabled = true; btnAddFav.Visibility = Visibility.Visible; sep1.Visibility = Visibility.Visible; sep2.Visibility = Visibility.Visible; btnExport.IsEnabled = true; btnExport.Visibility = Visibility.Visible; newResultFlag = 0; pageList = new List <Button>(); Button b; Console.WriteLine(resultList.getCount()); maxCount = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(resultList.getCount() / 20))); //updateStatusBar(maxCount.ToString()); Console.WriteLine(maxCount); //status.Text = "" + maxCount; for (int i = 0; i < 12; i++) { b = new Button(); b.HorizontalAlignment = HorizontalAlignment.Stretch; b.Background = new SolidColorBrush(Colors.White); b.Foreground = new SolidColorBrush(Colors.Blue); b.BorderBrush = Brushes.White; b.MaxWidth = 20; b.BorderThickness = new Thickness(0); b.Cursor = Cursors.Hand; b.Uid = i + ""; if (i == 0) { b.Content = b.Uid = "<<"; } else if (i == 11) { b.Content = b.Uid = ">>"; } else { b.Content = (i) + ""; } if (i == 1) { b.Foreground = new SolidColorBrush(Colors.Black); b.Background = Brushes.LightGray; } else { b.Background = Brushes.White; b.Foreground = new SolidColorBrush(Colors.Blue); } b.Click += b_Click; if (i > maxCount && i != 11) { b.IsEnabled = false; b.Visibility = Visibility.Hidden; } pageList.Add(b); if (currentPageSelected == 1) { pageList[0].Visibility = Visibility.Hidden; pageList[0].IsEnabled = false; } else { pageList[0].IsEnabled = true; pageList[0].Visibility = Visibility.Visible; } Pagination.Children.Add(pageList[i]); } } try { changePagination(currentPageSelected); } catch (Exception) { } if (resultList != null) { Pagination.Visibility = Visibility.Visible; Pagination.IsEnabled = true; foreach (Result r in resultList) { List <Paper> paperList = new List <Paper>(); paperList = r.getResults(); Page2 page; ListBoxItem item; foreach (Paper p in paperList) { page = new Page2(mw, this, p, fav); item = new ListBoxItem(); page.setAuthors(p.getauthors() + p.getYear()); page.setTitle(p.gettitle()); page.setDescription(p.getdescription()); page.setNumberOfCitations(p.getnumCitations()); page.setlinkUrl(p.geturl()); page.setCitationList(p.getcitationsUrl()); item = page.listItem; page.Content = null; this.ResultsPane.Items.Add(item); } } type = resultList.type; ResultType resultType = resultList.resultType; if ((type != null && type.getname() != null) && resultType == ResultType.AUTHOR) { //Console.WriteLine("Ohhhhhhhhhhhhhhhhh I didnt expect"); Author auth = new Author(); auth = (Author)type; this.statsUrl = auth.getstatsGraphUrl(); Page3 auth_profile = new Page3(this); auth_profile.auth_name.Text = type.getname(); auth_profile.num_cite.Text = type.getnumPapers().ToString(); auth_profile.hindex.Text = type.gethIndex().ToString(); auth_profile.iindex.Text = type.getiIndex().ToString(); Grid g = new Grid(); g = auth_profile.author_profile; auth_profile.Content = null; this.Author.Children.Clear(); this.Author.Children.Add(g); } else if (type != null && resultList.resultType == ResultType.JOURNAL) { //this.Author.Text = ""; type = new Journal(); type = (Journal)resultList.type; JournalPage auth_profile = new JournalPage(this); auth_profile.journal_name.Text = this.searchBox.Text; Journal j = (Journal)type; Grid g = new Grid(); g = auth_profile.author_profile; auth_profile.Content = null; this.Author.Children.Clear(); this.Author.Children.Add(g); this.statsUrl = j.getStatsUrl(); // Console.WriteLine("==========="+j.getStatsUrl().ToString()); } } }
public void setResult(ResultList resultList) { this.ResultsPane.Items.Clear(); firstSearchFlag = 1; if (newResultFlag == 1 && resultList != null) { btnAddFav.IsEnabled = true; btnAddFav.Visibility = Visibility.Visible; sep1.Visibility = Visibility.Visible; sep2.Visibility = Visibility.Visible; btnExport.IsEnabled = true; btnExport.Visibility = Visibility.Visible; newResultFlag = 0; pageList = new List<Button>(); Button b; Console.WriteLine(resultList.getCount()); maxCount = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(resultList.getCount() / 20))); //updateStatusBar(maxCount.ToString()); Console.WriteLine(maxCount); //status.Text = "" + maxCount; for (int i = 0; i < 12; i++) { b = new Button(); b.HorizontalAlignment = HorizontalAlignment.Stretch; b.Background = new SolidColorBrush(Colors.White); b.Foreground = new SolidColorBrush(Colors.Blue); b.BorderBrush = Brushes.White; b.MaxWidth = 20; b.BorderThickness = new Thickness(0); b.Cursor = Cursors.Hand; b.Uid = i + ""; if (i == 0) b.Content = b.Uid = "<<"; else if (i == 11) b.Content = b.Uid = ">>"; else b.Content = (i) + ""; if (i == 1) { b.Foreground = new SolidColorBrush(Colors.Black); b.Background = Brushes.LightGray; } else { b.Background = Brushes.White; b.Foreground = new SolidColorBrush(Colors.Blue); } b.Click += b_Click; if (i > maxCount && i != 11) { b.IsEnabled = false; b.Visibility = Visibility.Hidden; } pageList.Add(b); if (currentPageSelected == 1) { pageList[0].Visibility = Visibility.Hidden; pageList[0].IsEnabled = false; } else { pageList[0].IsEnabled = true; pageList[0].Visibility = Visibility.Visible; } Pagination.Children.Add(pageList[i]); } } try { changePagination(currentPageSelected); } catch (Exception) { } if (resultList != null) { Pagination.Visibility = Visibility.Visible; Pagination.IsEnabled = true; foreach (Result r in resultList) { List<Paper> paperList = new List<Paper>(); paperList = r.getResults(); Page2 page; ListBoxItem item; foreach (Paper p in paperList) { page = new Page2(mw, this, p, fav); item = new ListBoxItem(); page.setAuthors(p.getauthors() + p.getYear()); page.setTitle(p.gettitle()); page.setDescription(p.getdescription()); page.setNumberOfCitations(p.getnumCitations()); page.setlinkUrl(p.geturl()); page.setCitationList(p.getcitationsUrl()); item = page.listItem; page.Content = null; this.ResultsPane.Items.Add(item); } } type = resultList.type; ResultType resultType = resultList.resultType; if ((type != null && type.getname() != null) && resultType == ResultType.AUTHOR) { //Console.WriteLine("Ohhhhhhhhhhhhhhhhh I didnt expect"); Author auth = new Author(); auth = (Author)type; this.statsUrl = auth.getstatsGraphUrl(); Page3 auth_profile = new Page3(this); auth_profile.auth_name.Text = type.getname(); auth_profile.num_cite.Text = type.getnumPapers().ToString(); auth_profile.hindex.Text = type.gethIndex().ToString(); auth_profile.iindex.Text = type.getiIndex().ToString(); Grid g = new Grid(); g = auth_profile.author_profile; auth_profile.Content = null; this.Author.Children.Clear(); this.Author.Children.Add(g); } else if (type != null && resultList.resultType == ResultType.JOURNAL) { //this.Author.Text = ""; type = new Journal(); type = (Journal)resultList.type; JournalPage auth_profile = new JournalPage(this); auth_profile.journal_name.Text = this.searchBox.Text; Journal j = (Journal)type; Grid g = new Grid(); g = auth_profile.author_profile; auth_profile.Content = null; this.Author.Children.Clear(); this.Author.Children.Add(g); this.statsUrl = j.getStatsUrl(); // Console.WriteLine("==========="+j.getStatsUrl().ToString()); } } }