// Popup for grad degree private void showGradDegreeDetails(object sender2, EventArgs e2, Graduate gradDeg) { // Populate popup with data Popup popup = new Popup(gradDeg); popup.Show(); }
private void showDetails() { string degreelink = baseurl.getRestData("/degrees/graduate/degreeName=" + gid); g = JToken.Parse(degreelink).ToObject <Graduate>(); labelTitle.Text = g.title; labelTitle.MaximumSize = new Size(this.Width, 0); labelTitle.Location = new Point(this.Width / 4, 100); labelTitle.AutoSize = true; labelDescription.Text = g.description; labelDescription.MaximumSize = new Size(this.Width / 2, 0); labelDescription.Location = new Point((this.Width / 4), 150); labelDescription.AutoSize = true; labelCon.Text = "Concentrations"; labelCon.MaximumSize = new Size(this.Width / 2, 0); labelCon.Location = new Point((this.Width / 3), 250); labelCon.AutoSize = true; int count = 10; foreach (string cont in g.concentrations) { count = count + 40; Label label = new Label(); this.Controls.Add(label); label.BackColor = Color.Transparent; label.Font = new Font("Verdana", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); label.ForeColor = Color.Black; label.Text = cont; label.AutoSize = true; label.Location = new Point(((this.ClientSize.Width - label.Width) / 2), 250 + count); //label.MaximumSize = new Size(this.Width / 2, 0); label.TextAlign = ContentAlignment.MiddleCenter; } }
// Show Degrees section when "DEGREES" is clicked private void degrees_btn_Click(object sender, EventArgs e) { processButtons(sender); // Change body view to Degrees section body.SelectedTab = degrees_tab; // Ensure we have the data, fetch if we don't if (degrees == null) { Console.WriteLine("Loading degrees..."); string jsonDeg = rj.getRestJSON("/degrees/"); degrees = JToken.Parse(jsonDeg).ToObject <Degrees>(); // Dynamically load undergraduate degrees int row = 0; int column = 0; for (int i = 0; i < degrees.undergraduate.Count; i++) { Undergraduate currUgDeg = degrees.undergraduate[i]; // Create and populate panel for each degree TableLayoutPanel degreePanel = new TableLayoutPanel(); degreePanel.ColumnCount = 1; degreePanel.RowCount = 2; degreePanel.AutoSize = true; degreePanel.Dock = DockStyle.Fill; degreePanel.BorderStyle = BorderStyle.FixedSingle; foreach (RowStyle style in degreePanel.RowStyles) { style.SizeType = SizeType.AutoSize; } // Degree title Label degTitle = new Label(); degTitle.Text = currUgDeg.title; degTitle.Dock = DockStyle.Fill; degTitle.ForeColor = Color.DarkOrange; degTitle.Font = new Font("Arial", 9, FontStyle.Bold); degTitle.AutoSize = false; degTitle.Click += (sender4, e4) => showUgDegreePopup(sender4, e4, currUgDeg); degTitle.MouseEnter += (sender13, e13) => changeDegreeColor(sender13, e13, degreePanel); degTitle.MouseLeave += (sender14, e14) => changeDegreeColor(sender14, e14, degreePanel); degTitle.MaximumSize = new Size(100, 0); degTitle.AutoSize = true; // Degree description TextBox degDesc = new TextBox(); degDesc.ReadOnly = true; degDesc.Multiline = true; degDesc.Dock = DockStyle.Fill; degDesc.Text = currUgDeg.description; degDesc.Click += (sender3, e3) => showUgDegreePopup(sender3, e3, currUgDeg); degDesc.MouseEnter += (sender11, e11) => changeDegreeColor(sender11, e11, degreePanel); degDesc.MouseLeave += (sender12, e12) => changeDegreeColor(sender12, e12, degreePanel); SizeF size = degDesc.CreateGraphics() .MeasureString(degDesc.Text, degDesc.Font, degDesc.Width, new StringFormat(0)); degDesc.Height = (int)size.Height; // Add components to degree panel, then to main panel degreePanel.Controls.Add(degTitle, 0, 0); degreePanel.Controls.Add(degDesc, 0, 1); ug_degrees.Controls.Add(degreePanel, column, row); // Resize rows foreach (RowStyle style in ug_degrees.RowStyles) { style.SizeType = SizeType.AutoSize; } // Set onclick event handler to show degree details in popup degreePanel.Click += (sender2, e2) => showUgDegreePopup(sender2, e2, currUgDeg); degreePanel.MouseEnter += (sender9, e9) => changeDegreeColor(sender9, e9, degreePanel); degreePanel.MouseLeave += (sender10, e10) => changeDegreeColor(sender10, e10, degreePanel); // Jump to next row if current row is full if ((i + 1) % 3 == 0) { row++; column = 0; } else { column++; } } // Dynamically load graduate degrees and certificates row = 0; column = 0; for (int i = 0; i < degrees.graduate.Count; i++) { Graduate currGradDeg = degrees.graduate[i]; // If certificate, if (currGradDeg.degreeName == "graduate advanced certificates") { // Dynamically load research by faculty int certRow = 0; int certColumn = 0; for (int j = 0; j < currGradDeg.availableCertificates.Count; j++) { // Certificate title LinkLabel certTitle = new LinkLabel(); certTitle.Text = degrees.graduate[i].availableCertificates[j]; if (certTitle.Text == "Web Development Advanced certificate") { certTitle.Tag = "http://www.rit.edu/programs/web-development-adv-cert"; } else if (certTitle.Text == "Networking,Planning and Design Advanced Cerificate") { certTitle.Tag = "http://www.rit.edu/programs/networking-planning-and-design-adv-cert"; } certTitle.LinkClicked += linkLabel1_LinkClicked; certTitle.Margin = new Padding(0, 0, certTitle.Margin.Right, certTitle.Margin.Right); certTitle.BorderStyle = BorderStyle.FixedSingle; certTitle.TextAlign = ContentAlignment.MiddleCenter; certTitle.Anchor = (AnchorStyles.Left | AnchorStyles.Right); grad_certs.Controls.Add(certTitle, certColumn, certRow); // Jump to next row if current row is full if ((j + 1) % 3 == 0) { certRow++; certColumn = 0; } else { certColumn++; } } // Resize rows foreach (RowStyle style in grad_certs.RowStyles) { style.SizeType = SizeType.AutoSize; } // End current iteration of i loop here continue; } // Create and populate panel for each degree TableLayoutPanel degreePanel = new TableLayoutPanel(); degreePanel.ColumnCount = 1; degreePanel.RowCount = 2; degreePanel.AutoSize = true; degreePanel.Dock = DockStyle.Fill; degreePanel.BorderStyle = BorderStyle.FixedSingle; foreach (RowStyle style in degreePanel.RowStyles) { style.SizeType = SizeType.AutoSize; } // Degree title Label degTitle = new Label(); degTitle.Text = currGradDeg.title; degTitle.Dock = DockStyle.Fill; degTitle.ForeColor = Color.DarkOrange; degTitle.Font = new Font("Arial", 9, FontStyle.Bold); degTitle.Click += (sender4, e4) => showGradDegreeDetails(sender4, e4, currGradDeg); degTitle.MouseEnter += (sender19, e19) => changeDegreeColor(sender19, e19, degreePanel); degTitle.MouseLeave += (sender20, e20) => changeDegreeColor(sender20, e20, degreePanel); degTitle.AutoSize = false; degTitle.MaximumSize = new Size(100, 0); degTitle.AutoSize = true; // Degree description TextBox degDesc = new TextBox(); degDesc.ReadOnly = true; degDesc.Multiline = true; degDesc.Click += (sender3, e3) => showGradDegreeDetails(sender3, e3, currGradDeg); degDesc.MouseEnter += (sender17, e17) => changeDegreeColor(sender17, e17, degreePanel); degDesc.MouseLeave += (sender18, e18) => changeDegreeColor(sender18, e18, degreePanel); degDesc.Dock = DockStyle.Fill; degDesc.Text = currGradDeg.description; SizeF size = degDesc.CreateGraphics() .MeasureString(degDesc.Text, degDesc.Font, degDesc.Width, new StringFormat(0)); degDesc.Height = (int)size.Height; // Add components to degree panel, then to main panel degreePanel.Controls.Add(degTitle, 0, 0); degreePanel.Controls.Add(degDesc, 0, 1); grad_degrees.Controls.Add(degreePanel, column, row); // Resize rows foreach (RowStyle style in grad_degrees.RowStyles) { style.SizeType = SizeType.AutoSize; } // Set onclick event handler to show degree details in popup degreePanel.Click += (sender2, e2) => showGradDegreeDetails(sender2, e2, currGradDeg); degreePanel.MouseEnter += (sender15, e15) => changeDegreeColor(sender15, e15, degreePanel); degreePanel.MouseLeave += (sender16, e16) => changeDegreeColor(sender16, e16, degreePanel); // Jump to next row if current row is full if ((i + 1) % 3 == 0) { row++; column = 0; } else { column++; } } } }
// Constructs popup for Graduate degree public Popup(Graduate gDeg) { InitializeComponent(); thisGradDeg = gDeg; }
//code to show graduate degree offered private void graduateFn() { string degreelink = baseurl.getRestData("/degrees/"); //Console.WriteLine(degreelink); degree = JToken.Parse(degreelink).ToObject <DegreePrograms>(); List <Graduate> gdegree = degree.graduate; gTitle.Text = "Graduate Degrees"; gTitle.MaximumSize = new Size(1000, 0); gTitle.Location = new Point(((this.ClientSize.Width - gTitle.Width) / 2) - 75, 50); gTitle.AutoSize = true; TableLayoutPanel panelg = new TableLayoutPanel(); panelg.Location = new Point((this.ClientSize.Width - panelg.Width) / 6, 100); panelg.RowCount = 1; panelg.ColumnCount = gdegree.Count - 1; gPage.Controls.Add(panelg); for (int i = 0; i < gdegree.Count; i++) { Graduate g = gdegree[i]; if (g.availableCertificates == null) { MetroFramework.Controls.MetroTile tile = new MetroFramework.Controls.MetroTile(); tile.Size = new Size(300, 200); tile.TextAlign = ContentAlignment.MiddleCenter; tile.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(g.title); tile.Click += new EventHandler(TileClickEventG); tile.Style = MetroFramework.MetroColorStyle.Orange; tile.Name = g.degreeName; panelg.Controls.Add(tile, i, 0); } else { Label label = new Label(); gPage.Controls.Add(label); label.BackColor = Color.Transparent; label.Font = new Font("Verdana", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); label.ForeColor = Color.Black; label.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(g.degreeName); label.AutoSize = true; label.Location = new Point(((this.ClientSize.Width - label.Width) / 2), 350); //label.MaximumSize = new Size(this.Width / 2, 0); label.TextAlign = ContentAlignment.MiddleCenter; int count = 10; foreach (string cont in g.availableCertificates) { count = count + 40; Label label1 = new Label(); gPage.Controls.Add(label1); label1.BackColor = Color.Transparent; label1.Font = new Font("Verdana", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); label1.ForeColor = Color.Black; label1.Name = cont; label1.Text = cont; label1.AutoSize = true; label1.Location = new Point(((this.ClientSize.Width - label1.Width) / 2), 350 + count); //label.MaximumSize = new Size(this.Width / 2, 0); label1.TextAlign = ContentAlignment.MiddleCenter; } } } panelg.Size = new Size((gdegree.Count - 1) * 300, 200); }