public void EditSection(SectionsDataPanel caller) { var calling = new EditSections(Connector.connections[0].GetSection(sections[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 = false; panel1.Enabled = true; panel1.Controls.Clear(); sectionsdatas.Clear(); panel1.SuspendLayout(); await Task.Run(() => { if (sections.Count >= 7) { for (int i = 0; i < sections.Count; i++) { SectionsDataPanel panel = new SectionsDataPanel(this); panel.Dock = DockStyle.Top; panel.namelb.Text = sections[i].Name; panel.pagecountlb.Text += sections[i].PageCount.ToString(); panel.datelb.Text += sections[i].Date; panel.Width = 764; sectionsdatas.Add(panel); } } else { for (int i = 0; i < sections.Count; i++) { var panel = new SectionsDataPanel(this); panel.Dock = DockStyle.Top; panel.namelb.Text = sections[i].Name; panel.pagecountlb.Text += sections[i].PageCount.ToString(); panel.datelb.Text += sections[i].Date; panel.Width = 781; sectionsdatas.Add(panel); } } }); panel1.Controls.AddRange(sectionsdatas.ToArray()); panel1.ResumeLayout(); pictureBox1.Visible = false; panel1.Enabled = true; }