TaskItems2 인터페이스
TaskItems 컬렉션에는 작업 목록 창에 있는 모든 작업이 포함됩니다.
네임스페이스: EnvDTE80
어셈블리: EnvDTE80(EnvDTE80.dll)
구문
‘선언
<GuidAttribute("B820F931-645A-473F-8246-922CF069E1FE")> _
Public Interface TaskItems2 _
Inherits TaskItems
[GuidAttribute("B820F931-645A-473F-8246-922CF069E1FE")]
public interface TaskItems2 : TaskItems
[GuidAttribute(L"B820F931-645A-473F-8246-922CF069E1FE")]
public interface class TaskItems2 : TaskItems
[<GuidAttribute("B820F931-645A-473F-8246-922CF069E1FE")>]
type TaskItems2 =
interface
interface TaskItems
end
public interface TaskItems2 extends TaskItems
TaskItems2 형식에서는 다음과 같은 멤버를 노출합니다.
속성
이름 | 설명 | |
---|---|---|
![]() |
Count | 컬렉션에 있는 개체의 수를 나타내는 값을 가져옵니다. |
![]() |
DTE | 최상위 확장성 개체를 가져옵니다. |
![]() |
Parent | TaskItems 컬렉션의 바로 위 부모 개체를 가져옵니다. |
위쪽
메서드
이름 | 설명 | |
---|---|---|
![]() |
Add | TaskList에 새 작업 항목을 추가합니다. |
![]() |
Add2 | TaskList에 새 작업 항목을 추가합니다. |
![]() |
ForceItemsToTaskList | 추가되지 않은 모든 작업 항목을 작업 목록에 전달합니다. |
![]() |
GetEnumerator | 컬렉션의 항목에 대한 열거형을 가져옵니다. |
![]() |
Item | TaskItems 컬렉션의 인덱싱된 멤버를 반환합니다. |
위쪽
예제
이 예제에서는 작업 항목 두 개를 작업 목록에 추가하고 해당 속성의 일부를 메시지 상자에 표시합니다. 이 예제를 추가 기능으로 실행하는 방법에 대한 자세한 내용은 방법: 자동화 개체 모델 코드의 예제 컴파일 및 실행을 참조하십시오.
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)
TaskItems2Example(_applicationObject)
End Sub
Sub TaskItems2Example(ByVal dte As DTE2)
Dim win As Window = _applicationObject.Windows.Item _
(Constants.vsWindowKindTaskList)
Dim TL As TaskList = CType(win.Object, TaskList)
Dim TLItem As TaskItem
Dim TLItems As TaskItems2
TLItems = CType(TL.TaskItems, TaskItems2)
' Add a couple of tasks to the Task List.
TLItem = TLItems.Add(" ", " ", "Test task 1.", _
vsTaskPriority.vsTaskPriorityHigh, vsTaskIcon.vsTaskIconUser _
, True, , 10, , )
TLItem = TLItems.Add(" ", " ", "Test task 2." _
, vsTaskPriority.vsTaskPriorityLow, vsTaskIcon.vsTaskIconComment _
, , , 20, , )
' List the total number of task list items after adding the new
' task items.
MsgBox("Task Item 1 description: " & TLItems.Item(2).Description)
MsgBox("Total number of task items: " & TLItems.Count)
' Remove the second task item.
' The items list in reverse numeric order.
MsgBox("Deleting the second task item")
TLItems.Item(1).Delete()
MsgBox("Total number of task items: " & TLItems.Count)
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;
TaskItems2Example(_applicationObject);
}
public void TaskItems2Example(DTE2 dte)
{
Window2 win = (Window2)_applicationObject.Windows.Item
(Constants.vsWindowKindTaskList);
TaskList TL = (TaskList)win.Object;
TaskItem TLItem;
TaskItems2 TLItems;
TLItems = (TaskItems2)TL.TaskItems;
// Add a couple of tasks to the Task List.
TLItem = TLItems.Add("MyTask", "MyTask1", "Test task 1."
, vsTaskPriority.vsTaskPriorityHigh, vsTaskIcon.vsTaskIconUser
, true,null,10,true,true );
TLItem = TLItems.Add("MyTask", "MyTask1", "Test task 2."
, vsTaskPriority.vsTaskPriorityLow, vsTaskIcon.vsTaskIconComment
, true, null, 20, true, true);
// List the total number of task list items after adding the new
// task items.
MessageBox.Show("Task Item 1 description: " +
TLItems.Item(2).Description);
MessageBox.Show("Total number of task items: "
+ TLItems.Count.ToString());
// Remove the second task item.
// The items list in reverse numeric order.
MessageBox.Show("Deleting the second task item");
TLItems.Item(1).Delete();
MessageBox.Show("Total number of task items: " + TLItems.Count);
}