IControlPanel.GetCategories(String) Method

Definition

Retrieves the set of categories that are registered for the specified category type.

public:
 System::Collections::ObjectModel::ReadOnlyCollection<Microsoft::Web::Management::Client::ControlPanelCategoryInfo ^> ^ GetCategories(System::String ^ categorization);
public System.Collections.ObjectModel.ReadOnlyCollection<Microsoft.Web.Management.Client.ControlPanelCategoryInfo> GetCategories (string categorization);
abstract member GetCategories : string -> System.Collections.ObjectModel.ReadOnlyCollection<Microsoft.Web.Management.Client.ControlPanelCategoryInfo>
Public Function GetCategories (categorization As String) As ReadOnlyCollection(Of ControlPanelCategoryInfo)

Parameters

categorization
String

The category string that was used to register the category.

Returns

A constructed generic ReadOnlyCollection<T> of ControlPanelCategoryInfo objects that represent the categories that have been registered for the specified category type.

Examples

The following example displays all the categories for the Home page of a connection.

List<string> GetAllCategories(ICollection categories) {

    List<string> strLst = new List<string>();

    if (categories != null)
        foreach (ControlPanelCategoryInfo cpci in categories)
            strLst.Add(cpci.Name);

    // cpci.Text is the "friendly name"
    // such as "Application Development"
    // while cpci.Name is "ApplicationDevelopment"

    return strLst;
}
void TrcCats() {

    IControlPanel controlPanel =
        (IControlPanel)GetService(typeof(IControlPanel));

    string cpcA =
        ControlPanelCategorization.AreaCategorization;
    string cpcC =
        ControlPanelCategorization.CategoryCategorization;

    Trace.WriteLine("AreaCategorization");
    Trace.Indent();
    List<string> strLst =
        GetAllCategories(controlPanel.GetCategories(cpcA));
    foreach (string s in strLst)
        Trace.WriteLine(s);
    Trace.Unindent();

    Trace.WriteLine("\n CategoryCategorization");
    Trace.Indent();
    strLst = GetAllCategories(
        controlPanel.GetCategories(cpcC));
    foreach (string s in strLst)
        Trace.WriteLine(s);
    Trace.Unindent();
}

Remarks

Each category is represented by a ControlPanelCategoryInfo object.

Applies to