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; } }
void Initialize() { newcoursepanel = new CoursePanel() { Size = mainpl.Size, Dock = DockStyle.Fill }; mainpl.Controls.Add(newcoursepanel); newinstructorpanel = new InstructorPanel() { Size = mainpl.Size, Dock = DockStyle.Fill }; mainpl.Controls.Add(newinstructorpanel); newmaterialpanel = new MaterialPanel() { Size = mainpl.Size, Dock = DockStyle.Fill }; mainpl.Controls.Add(newmaterialpanel); newlecturepanel = new LecturesPanel() { Size = mainpl.Size, Dock = DockStyle.Fill }; mainpl.Controls.Add(newlecturepanel); newsectionpanel = new SectionsPanel() { Size = mainpl.Size, Dock = DockStyle.Fill }; mainpl.Controls.Add(newsectionpanel); newbookpanel = new BooksPanel() { Size = mainpl.Size, Dock = DockStyle.Fill }; mainpl.Controls.Add(newbookpanel); newabout = new About() { Size = mainpl.Size, Dock = DockStyle.Fill }; mainpl.Controls.Add(newabout); }