//========================================= // onHeapRegister //========================================= private void button3_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Group File List .gfl|*.gfl"; ofd.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory; if (ofd.ShowDialog() == DialogResult.OK) { FileGroupingElement fge = new FileGroupingElement(); if (!fge.loadGroupList(ofd.FileName)) { return; } fge.onConnect(); fge.Dock = DockStyle.Fill; TabPage tp = new TabPage(); tp.Controls.Add(fge); tp.Text = Path.GetFileName(ofd.FileName); tp.BackColor = Color.FromArgb(63, 63, 63); tabControl1.TabPages.Add(tp); tabControl1.Visible = true; } }
//========================================= // onConnect //========================================= public void onConnect() { for (int i = 0; i < tabControl1.TabPages.Count; i++) { for (int j = 0; j < tabControl1.TabPages[i].Controls.Count; j++) { if (tabControl1.TabPages[i].Controls[j] is FileGroupingElement) { FileGroupingElement fge = (FileGroupingElement)tabControl1.TabPages[i].Controls[j]; fge.onConnect(); } } } }