// START OF RESEARCH private void lbl_interest_lookup_Enter(object sender, EventArgs e) { string jsonResearch = rest.getRESTData("/research/"); Research research = JToken.Parse(jsonResearch).ToObject <Research>(); populateResearchCB(research); dg_citations.Font = new Font("Trebuchet MS", 9, FontStyle.Regular); }
public void createResearchTab() { String jsonResearch = istRest.getRESTData("/research/"); // Cast the objects Research research = JToken.Parse(jsonResearch).ToObject <Research>(); int x = 50; int y = 50; foreach (ByFaculty fac in research.byFaculty) { Panel panel = new Panel(); panel.Size = new Size(400, 50); panel.BackColor = Color.Orange; panel.Click += (s, e) => { PopupForm p = new PopupForm(fac.citations); p.ShowDialog(); }; Label label = e.createLabel(fac.facultyName, 0, 0); label.Click += (s, e) => { PopupForm p = new PopupForm(fac.citations); p.ShowDialog(); }; panel.Controls.Add(label); panel.Location = new Point(x, y); researchTab.Controls.Add(panel); y += 90; } x += 500; y = 50; foreach (ByInterestArea area in research.byInterestArea) { Panel panel = new Panel(); panel.Size = new Size(400, 50); panel.BackColor = Color.Orange; panel.Click += (s, e) => { PopupForm p = new PopupForm(area.citations); p.ShowDialog(); }; Label label = e.createLabel(area.areaName, 0, 0); label.Click += (s, e) => { PopupForm p = new PopupForm(area.citations); p.ShowDialog(); }; panel.Controls.Add(label); panel.Location = new Point(x, y); researchTab.Controls.Add(panel); y += 90; } }
// populate the look up combo boxes public void populateResearchCB(Research research) { // populates the faculty combo box for (var i = 0; i < research.byFaculty.Count; i++) { cb_fac_lookup.Items.Add(research.byFaculty[i].facultyName); } // populates the interest combo box for (var i = 0; i < research.byInterestArea.Count; i++) { cb_int_lookup.Items.Add(research.byInterestArea[i].areaName); } }
private void cb_int_lookup_SelectedIndexChanged(object sender, EventArgs e) { var selectedName = cb_int_lookup.SelectedItem; var selectedIndex = cb_int_lookup.SelectedIndex; string jsonResearch = rest.getRESTData("/research/"); Research research = JToken.Parse(jsonResearch).ToObject <Research>(); lbl_lookup_info_header.Text = research.byInterestArea[selectedIndex].areaName; dg_citations.Rows.Clear(); for (int i = 0; i < research.byInterestArea[selectedIndex].citations.Count; i++) { dg_citations.Rows.Add(); dg_citations.Rows[i].Cells[0].Value = research.byInterestArea[selectedIndex].citations[i]; } // end for }