Share via


TaskList.GetTaskItems Method

Definition

When overridden in a derived class, returns a collection of MethodTaskItem objects.

public:
 abstract System::Collections::ICollection ^ GetTaskItems();
public abstract System.Collections.ICollection GetTaskItems ();
abstract member GetTaskItems : unit -> System.Collections.ICollection
Public MustOverride Function GetTaskItems () As ICollection

Returns

A collection of MethodTaskItem objects that is used by Microsoft.Web.Management classes to invoke methods by name.

Examples


/// GetTaskItems() is called every time the context menu is invoked.
public override System.Collections.ICollection GetTaskItems() {

    ArrayList items = new ArrayList();

    Image imgAsk = rLoadImg.loadImgs(SystemIcons.Asterisk, 16);
    Image imgErr = rLoadImg.loadImgs(SystemIcons.Error, 16);

    items.Add(new MethodTaskItem(
                "DisplayTime",       // Method Name
                "Show Time",        // Menu item Text
                "DemoCategory")    // Category
                );

    Person prs = new Person(66, "Joe", "Smith");
    MethodTaskItem mti_i = new MethodTaskItem(
                                    "InvTst",       // Method Name
                                    "Invoke Test",   // Menu item Text
                                    sDemoCat,       // Category
                                    "Tool Tip:SC",  // ToolTip non-functional
                                    imgAsk,          // Menu Icon
                                    prs);      // user data
    mti_i.CausesNavigation = false;
    traceMTI(mti_i);

    items.Add(mti_i);


    items.Add(new MethodTaskItem(
          "ShowCnt",       // Method Name
          "Show Count",   // Menu item Text
          sDemoCat,       // Category
          "Tool Tip:SC",  // ToolTip non-functional
          mti_i.Image)    // Menu Icon
          );

}
    foreach (TaskItem item in items)
    {
        if (item is MethodTaskItem)
            item.Enabled = true;
    }
    return items;
}

Applies to