private void RefreshList() { IDisplayControl display = GetCurrentDisplay(); if (display != null) { display.RefreshList(); } }
/// <summary> /// Reacts to the selection of a specific tab page by ensuring that /// a display has been attached. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tabControl_Selected(object sender, TabControlEventArgs e) { IDisplayControl display = (IDisplayControl)e.TabPage.Tag; if (display == null) { if (e.TabPage == domainsPage) { AttachListData <DomainListData>(domainsPage); } else if (e.TabPage == entityTypesPage) { AttachListData <EntityListData>(entityTypesPage); } else if (e.TabPage == fontsPage) { AttachListData <FontListData>(fontsPage); } else if (e.TabPage == idGroupsPage) { AttachListData <IdGroupListData>(idGroupsPage); } else if (e.TabPage == layersPage) { AttachListData <LayerListData>(layersPage); } else if (e.TabPage == propertiesPage) { AttachDisplay <PropertyGridControl>(propertiesPage); } else if (e.TabPage == tablesPage) { AttachListData <TableListData>(tablesPage); } else if (e.TabPage == templatesPage) { AttachListData <TemplateListData>(templatesPage); } else if (e.TabPage == themesPage) { AttachListData <ThemeListData>(themesPage); } else if (e.TabPage == zonesPage) { AttachListData <ZoneListData>(zonesPage); } else { throw new Exception("No display for tab page"); } display = (IDisplayControl)e.TabPage.Tag; } Debug.Assert(display != null); // Ensure the display is up to date. This is meant to cover the // fact that items on one page may have been removed via changes // on other pages. display.RefreshList(); }