public void EditCourse(CourseDataPanel caller) { var calling = new EditCourse(Connector.connections[0].GetCourse(courses[panel1.Controls.IndexOf(caller)].ID), this) { Anchor = AnchorStyles.Top | AnchorStyles.Bottom }; calling.Size = this.Size; this.Controls.Add(calling); calling.BringToFront(); }
async void Initialize() { searched = false; pictureBox1.Visible = true; panel1.Enabled = false; panel1.Controls.Clear(); coursesdatas.Clear(); panel1.SuspendLayout(); await Task.Run(() => { if (courses.Count >= 7) { for (int i = 0; i < courses.Count; i++) { var panel = new CourseDataPanel(this); panel.Dock = DockStyle.Top; panel.coursenamelb.Text = courses[i].Name; panel.instrectornamelb.Text = courses[i].Instructor.FullName; panel.startlb.Text += courses[i].time.ToString() + " " + courses[i].Day.ToString(); panel.periodlb.Text += courses[i].period.ToString(); panel.lecnolb.Text += courses[i].Material.NumberOfLectures.ToString(); panel.secnolb.Text += courses[i].Material.NumberOfSections.ToString(); panel.booksnolb.Text += courses[i].Material.NumberOfBooks.ToString(); panel.rowdatabarpl.Width = 764; panel.Width = 764; coursesdatas.Add(panel); } } else { for (int i = 0; i < courses.Count; i++) { var panel = new CourseDataPanel(this); panel.Dock = DockStyle.Top; panel.coursenamelb.Text = courses[i].Name; panel.instrectornamelb.Text = courses[i].Instructor.FullName; panel.startlb.Text += courses[i].time.ToString() + " " + courses[i].Day.ToString(); panel.periodlb.Text += courses[i].period.ToString(); panel.lecnolb.Text += courses[i].Material.NumberOfLectures.ToString(); panel.secnolb.Text += courses[i].Material.NumberOfSections.ToString(); panel.booksnolb.Text += courses[i].Material.NumberOfBooks.ToString(); panel.Width = 781; coursesdatas.Add(panel); } } }); panel1.Controls.AddRange(coursesdatas.ToArray()); panel1.ResumeLayout(); pictureBox1.Visible = false; panel1.Enabled = true; }