private void AddConfigTab(IEventSource source) { var tabPage = new TabPage { Name = source.Name, Text = "Event Source " + source.GetType().Name }; var control = source.CreateConfigControl(); if (control != null) { control.Dock = DockStyle.Fill; control.BackColor = SystemColors.ControlLightLight; tabPage.Controls.Add(control); this.tabControl.TabPages.Add(tabPage); } }
private void AddConfigTab(IEventSource source) { var label = source.GetType().Name; if (esNames.ContainsKey(label)) { label = esNames[label]; } var tabPage = new ConfigTabPage { Name = source.Name, Text = "", IsEventSource = true, }; var control = source.CreateConfigControl(); if (control != null) { control.Dock = DockStyle.Fill; control.BackColor = SystemColors.ControlLightLight; tabPage.Controls.Add(control); var index = 0; foreach (var page in this.tabControl.TabPages) { if (index == 0 || ((ConfigTabPage)page).IsEventSource) { index++; } else { break; } } this.tabControl.TabPages.Insert(index, tabPage); } }