ToolWindows.TaskList 屬性
取得 TaskList 物件。
命名空間: EnvDTE80
組件: EnvDTE80 (在 EnvDTE80.dll 中)
語法
'宣告
ReadOnly Property TaskList As TaskList
Get
TaskList TaskList { get; }
property TaskList^ TaskList {
TaskList^ get ();
}
abstract TaskList : TaskList
function get TaskList () : TaskList
屬性值
型別:EnvDTE.TaskList
TaskList 物件。
範例
這個範例會開啟 [工作清單] 視窗,並在其中加入兩個項目之後刪除其中一項。
如需如何像執行增益集一般,執行這個範例的詳細資訊,請參閱 HOW TO:編譯和執行 Automation 物件模型程式碼範例。
Imports EnvDTE
Imports EnvDTE80
Public Sub OnConnection(ByVal application As Object, _
ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
ByRef custom As Array) Implements IDTExtensibility2.OnConnection
_applicationObject = CType(application, DTE2)
_addInInstance = CType(addInInst, AddIn)
TaskListManip(_applicationObject)
End Sub
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 OnConnection(object application,
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
TaskListManip(_applicationObject);
}
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());
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。