private void _tabButton_SelectedChanged(object sender, EventArgs e) { Debug.Assert(sender is NuGenTabButton, "sender is NuGenTabButton"); NuGenTabButton tabButton = (NuGenTabButton)sender; if (tabButton.Selected) { Debug.Assert(_buttonPageDictionary != null, "_buttonPageDictionary != null"); Debug.Assert(_buttonPageDictionary.ContainsKey(tabButton), "_buttonPageDictionary.ContainsKey(tabButton)"); NuGenTabPage activeTabPage = _buttonPageDictionary[tabButton]; Debug.Assert(activeTabPage != null, "activeTabPage != null"); activeTabPage.BringToFront(); } }
/* * InitializeTabPage */ private NuGenTabButton InitializeTabPage(NuGenTabPage tabPageToInitialize) { Debug.Assert(tabPageToInitialize != null, "tabPageToInitialize != null"); Debug.Assert(this.ServiceProvider != null, "this.ServiceProvider != null"); NuGenTabButton tabButtonToAssociate = new NuGenTabButton(this.ServiceProvider); tabButtonToAssociate.Image = tabPageToInitialize.TabButtonImage; tabButtonToAssociate.Text = tabPageToInitialize.Text; Debug.Assert(_buttonPageDictionary != null, "_buttonPageDictionary != null"); Debug.Assert(_pageButtonDictionary != null, "_pageButtonDictionary != null"); _buttonPageDictionary.Add(tabButtonToAssociate, tabPageToInitialize); _pageButtonDictionary.Add(tabPageToInitialize, tabButtonToAssociate); tabPageToInitialize.EnabledChanged += _tabPage_EnabledChanged; tabPageToInitialize.TabButtonImageChanged += _tabPage_TabButtonImageChanged; tabPageToInitialize.TextChanged += _tabPage_TextChanged; this.Controls.Add(tabPageToInitialize); tabPageToInitialize.BringToFront(); return(tabButtonToAssociate); }
/* * InitializeTabPage */ private NuGenTabButton InitializeTabPage(NuGenTabPage tabPageToInitialize) { Debug.Assert(tabPageToInitialize != null, "tabPageToInitialize != null"); Debug.Assert(this.ServiceProvider != null, "this.ServiceProvider != null"); NuGenTabButton tabButtonToAssociate = new NuGenTabButton(this.ServiceProvider); tabButtonToAssociate.Image = tabPageToInitialize.TabButtonImage; tabButtonToAssociate.Text = tabPageToInitialize.Text; Debug.Assert(_buttonPageDictionary != null, "_buttonPageDictionary != null"); Debug.Assert(_pageButtonDictionary != null, "_pageButtonDictionary != null"); _buttonPageDictionary.Add(tabButtonToAssociate, tabPageToInitialize); _pageButtonDictionary.Add(tabPageToInitialize, tabButtonToAssociate); tabPageToInitialize.EnabledChanged += _tabPage_EnabledChanged; tabPageToInitialize.TabButtonImageChanged += _tabPage_TabButtonImageChanged; tabPageToInitialize.TextChanged += _tabPage_TextChanged; this.Controls.Add(tabPageToInitialize); tabPageToInitialize.BringToFront(); return tabButtonToAssociate; }