Create a Top-Level Tab

 

Applies To: Windows Server 2012 Essentials, Windows Home Server 2011, Windows Storage Server 2008 R2 Essentials, Windows Small Business Server 2011 Essentials

A top-level tab is a basic element on the Windows Server Essentials Dashboard. You can develop an add-in that adds a basic tab to the Dashboard. Once you have created the basic top-level tab, you can add additional content to the tab, such as a list view or multiple sub-tabs. Windows Server Essential SDK contains templates for these additional tabs.

The following procedure walks you through creating a top-level tab.

To create a top-level tab

  1. Open the Visual Studio solution that you created in Set Up the Development Environment.

    Note

    When you create the Visual Studio solution, you should make sure that you use the appropriate template for the type of tab that you need. Some templates for creating add-ins are described in the previous topic. In addition, you can also use the following templates that are optimized for top-level tabs:

    • Top-level tab with list view content. Use the WSS Top-Level Tab ListView template to create this tab.
    • Top-level tab with a Windows Forms custom control. Use the WSS Top-Level Tab with Winforms template to create this tab.
    • Top-level tab with a Windows Presentation Foundation (WPF) custom control. Use the WSS Top-Level Tab WPF template to create this tab.
    • Top-level tab with multiple subtabs. Use the WSS Top-Level Tab with Two Subtabs template to create this tab.
  2. In the TopLevelTab project, open the TopLevelTab.cs file.

  3. You must provide identifying information for your top-level tab. Change the name and description in the constructor of the class as well as the GUID passed to the base class’s constructor:

    public TopLevelTabPageProvider()  
       : base(new Guid([Insert new GUID here.]),  
       "My Tab Name", // String to display on the tab  
       "My Tab Description") // description for the add-in  
    {  
    }  
    

    My Tab Name is the name of your tab. My Tab Description is the tool tip description for your tab that is displayed when the mouse hovers over the tab name.

    Important

    You must supply your own unique GUID. For more information about creating a GUID, see Create Guid (guidgen.exe) (https://go.microsoft.com/fwlink/?LinkId=116098).

  4. If your top-level tab will contain one or more custom control subtabs, you must include the ContainsCustomControl attribute as shown in the following code example:

    [ContainsCustomControl]  
    public class TopLevelTabPageProvider : PageProvider  
    {  
    }  
    
  5. You can define the icon that represents your tab by overriding the CreateImage method. The following code example shows how to override the CreateImage method:

    protected override System.Drawing.Icon CreateImage()  
    {  
       // This should be your own resource  
       return SystemIcons.Shield;  
    }  
    

    Note

    The size of the icon is 32 X 32.

  6. A top-level tab must contain at least one subtab and it can contain multiple subtabs. You define the subtabs of the top-level tab by overriding the CreatePages method. The CreatePages method returns an array of all the subtabs that you want to include in the top-level tab. The following code example shows how to add a single subtab that is defined in the SubTab project:

    protected override object CreatePages()  
    {  
       Page pageSample = new SubTabPage();  
       Page[] pages = new Page[] { pageSample };  
       return pages;  
    }  
    
  7. Save and build the project.

After you finish the initial steps for creating a top-level tab, you can perform the steps to complete the type of tab that you chose to implement. The following sections provide information that you can use to create the different types of top-level tabs: