public void Open(object caller, string who) { switch (who) { case "lecture": var calling = new LecturesPanel(Connector.connections[0].GetInstructor(instructors[panel1.Controls.IndexOf((InstructorDataPanel)caller)].ID).ID, "instructor", this) { Anchor = AnchorStyles.Top | AnchorStyles.Bottom }; calling.Size = this.Size; this.Controls.Add(calling); calling.BringToFront(); break; case "section": var calling1 = new SectionsPanel(Connector.connections[0].GetInstructor(instructors[panel1.Controls.IndexOf((InstructorDataPanel)caller)].ID).ID, "instructor", this) { Anchor = AnchorStyles.Top | AnchorStyles.Bottom }; calling1.Size = this.Size; this.Controls.Add(calling1); calling1.BringToFront(); break; case "book": var calling2 = new BooksPanel(Connector.connections[0].GetInstructor(instructors[panel1.Controls.IndexOf((InstructorDataPanel)caller)].ID).ID, "instructor", this) { Anchor = AnchorStyles.Top | AnchorStyles.Bottom }; calling2.Size = this.Size; this.Controls.Add(calling2); calling2.BringToFront(); break; case "course": var calling3 = new CoursePanel(Connector.connections[0].GetInstructor(instructors[panel1.Controls.IndexOf((InstructorDataPanel)caller)].ID).ID, "instructor", this) { Anchor = AnchorStyles.Top | AnchorStyles.Bottom }; calling3.Size = this.Size; this.Controls.Add(calling3); calling3.BringToFront(); break; case "material": var calling4 = new MaterialPanel(Connector.connections[0].GetInstructor(instructors[panel1.Controls.IndexOf((InstructorDataPanel)caller)].ID).ID, "instructor", this) { Anchor = AnchorStyles.Top | AnchorStyles.Bottom }; calling4.Size = this.Size; this.Controls.Add(calling4); calling4.BringToFront(); break; } }
private void Coursesbtn_Click(object sender, MouseEventArgs e) { newcoursepanel._update(); newcoursepanel.BringToFront(); }