Compartilhar via


ToolWindows.TaskList Property

Definition

Gets the TaskList object.

public:
 property EnvDTE::TaskList ^ TaskList { EnvDTE::TaskList ^ get(); };
public:
 property EnvDTE::TaskList ^ TaskList { EnvDTE::TaskList ^ get(); };
[System.Runtime.InteropServices.DispId(9)]
public EnvDTE.TaskList TaskList { [System.Runtime.InteropServices.DispId(9)] get; }
[<System.Runtime.InteropServices.DispId(9)>]
[<get: System.Runtime.InteropServices.DispId(9)>]
member this.TaskList : EnvDTE.TaskList
Public ReadOnly Property TaskList As TaskList

Property Value

A TaskList object.

Attributes

Examples

This example opens the Task List window, adds two items to it, and deletes one of them.

Imports EnvDTE  
Imports EnvDTE80  
Public Sub TaskListManip(ByVal dte As DTE2)  
    Dim myTaskList As TaskList  
    myTaskList = _applicationObject.ToolWindows.TaskList  
    Dim myTaskItems As EnvDTE80.TaskItems2  
    myTaskItems = CType(myTaskList.TaskItems, EnvDTE80.TaskItems2)  
    _applicationObject.ExecuteCommand("View.TaskList", " ")  
    MsgBox("Total number of task items: " _  
    & myTaskList.TaskItems.Count.ToString())  
    Dim myTaskItem As TaskItem  
    myTaskItem = myTaskItems.Add2("", "", "Test task. ",  _  
1, vsTaskIcon.vsTaskIconUser, False, "", 10, True, True, True)  
    myTaskItem = myTaskItems.Add2("", "", "Test task 1. ", _  
 3, vsTaskIcon.vsTaskIconSquiggle, False, "", 10, True, True, True)  
    myTaskItem = myTaskItems.Add2("", "", "Test task 2. ",  _  
3, vsTaskIcon.vsTaskIconComment, False, "", 10, True, True, True)  
    MsgBox("Total number of task items: "  _  
    & myTaskList.TaskItems.Count.ToString())  
    ' Remove the second item. The items list in reverse numeric order.  
    myTaskList.TaskItems.Item(1).Delete()  
    MsgBox("Total number of task items: "  _  
    & myTaskList.TaskItems.Count.ToString())  
End Sub  
using EnvDTE;  
using EnvDTE80;  
using System.Windows.Forms;  
public void TaskListManip(DTE2 dte)  
{  
    TaskList myTaskList;  
    myTaskList = _applicationObject.ToolWindows.TaskList;  
    EnvDTE80.TaskItems2 myTaskItems;  
    myTaskItems = (EnvDTE80.TaskItems2)myTaskList.TaskItems;  
    _applicationObject.ExecuteCommand("View.TaskList", " ");  
    MessageBox.Show("Total number of task items: "   
+ myTaskList.TaskItems.Count.ToString());  
TaskItem myTaskItem;  
    myTaskItem = myTaskItems.Add2("", "", "Test task. ", 1,   
vsTaskIcon.vsTaskIconUser, false, "", 10, true, true, true);  
    myTaskItem = myTaskItems.Add2("", "", "Test task 1. ", 3,   
vsTaskIcon.vsTaskIconSquiggle, false, "", 10, true, true, true);  
    myTaskItem = myTaskItems.Add2("", "", "Test task 2. ", 3,  
 vsTaskIcon.vsTaskIconComment, false, "", 10, true, true, true);  
    MessageBox.Show("Total number of task items: "   
+ myTaskList.TaskItems.Count.ToString());  
    // Remove the second item. The items list in reverse numeric order.  
    myTaskList.TaskItems.Item(1).Delete();  
    MessageBox.Show("Total number of task items: "   
+ myTaskList.TaskItems.Count.ToString());  
}  

Applies to