방법: 작업 목록 제어

작업 목록 및 해당 내용을 자동화를 통해 제어할 수 있습니다. 이는 Visual Studio 자동화 모델에서 다음 개체 및 컬렉션으로 표현됩니다.

개체 이름

설명

TaskList 개체

작업 목록을 나타냅니다.

TaskItems 컬렉션

작업 목록의 모든 작업을 나타냅니다.

TaskItem 개체

작업 목록의 단일 작업 항목을 나타냅니다.

TaskListEvents 개체

작업 목록에서 발생하는 이벤트에 응답합니다.

이러한 개체와 컬렉션을 사용하여 다음 작업을 수행할 수 있습니다.

  • 작업 항목을 만들어 작업 목록에 추가하거나(Add 메서드) 작업 목록에서 작업 항목 삭제(Delete 메서드)

  • 현재 작업 목록에 있는 항목 가져오기(Select 메서드)

  • 작업 항목과 관련된 문서 표시(Navigate 메서드)

  • 작업 항목 선택(Select 메서드)

  • 작업 항목이 추가, 제거, 수정 또는 선택될 때 응답(TaskAdded, TaskRemoved, TaskModifiedTaskNavigated 이벤트)

작업 목록의 내용뿐 아니라 너비 및 높이와 같은 특성도 제어할 수 있습니다. 자세한 내용은 방법: 창 특성 변경을 참조하십시오.

참고

표시되는 대화 상자와 메뉴 명령은 활성 설정이나 버전에 따라 도움말에서 설명하는 것과 다를 수 있습니다. 이러한 절차는 일반 개발 설정을 사용하여 개발되었습니다. 설정을 변경하려면 도구 메뉴에서 설정 가져오기 및 내보내기를 선택합니다. 자세한 내용은 설정에 대한 작업을 참조하십시오.

예제

다음 추가 기능 예제에서는 작업 목록 자동화 모델의 다양한 멤버를 참조하고 사용하는 방법을 보여 줍니다. 이 예제에서는 작업 목록에 몇 개의 새 작업을 추가하고 작업 수를 표시한 다음 작업 하나를 삭제합니다. 다음 예제를 실행하기 전에 보기 메뉴에서 작업 목록을 선택하십시오. 추가 기능 및 매크로 범주에 작업이 나타납니다.

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)
    ' Pass the applicationObject member variable to the code example.
    TaskListExample(_applicationObject)
End Sub

Sub TaskListExample(ByVal dte As DTE2)
    Dim tl As TaskList = dte.ToolWindows.TaskList
    Dim tlItem As TaskItem

    ' Add a couple of tasks to the Task List.
    tlItem = tl.TaskItems.Add(" ", " ", "Test task 1.", _
      vsTaskPriority.vsTaskPriorityHigh, vsTaskIcon.vsTaskIconUser, _
      True, , 10, , )
    tlItem = tl.TaskItems.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: " & _
      tl.TaskItems.Item(2).Description)
    MsgBox("Total number of task items: " & tl.TaskItems.Count)

    ' Remove the second task item. The items list in reverse numeric 
    ' order.
    MsgBox("Deleting the second task item")
    tl.TaskItems.Item(2).Delete()
    MsgBox("Total number of task items: " & tl.TaskItems.Count)
End Sub
using System.Windows.Forms;
public void OnConnection(object application, ext_ConnectMode   
connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    // Pass the applicationObject member variable to the code example.
    TaskListExample(_applicationObject);
}

public void TaskListExample(DTE2 dte)
{
    TaskList tl = (TaskList)dte.ToolWindows.TaskList;
    TaskItem tlItem;
    
    // Add a couple of tasks to the Task List.
    tlItem = tl.TaskItems.Add(" ", " ", "Test task 1.",  
      vsTaskPriority.vsTaskPriorityHigh, vsTaskIcon.vsTaskIconUser, 
      true, "", 10, true, true);
    tlItem = tl.TaskItems.Add(" ", " ", "Test task 2.", 
      vsTaskPriority.vsTaskPriorityLow, vsTaskIcon.vsTaskIconComment, 
      true, "", 20, true,true);

    // List the total number of task list items after adding the new 
    // task items.
    System.Windows.Forms.MessageBox.Show("Task Item 1 description: 
      "+tl.TaskItems.Item(2).Description);
    System.Windows.Forms.MessageBox.Show("Total number of task items: 
      "+tl.TaskItems.Count);

    // Remove the second task item. The items list in reverse numeric 
    // order.
    System.Windows.Forms.MessageBox.Show("Deleting the second task 
      item");
    tl.TaskItems.Item(2).Delete();
    System.Windows.Forms.MessageBox.Show("Total number of task items: 
      "+tl.TaskItems.Count);
}

참고 항목

작업

방법: 창 특성 변경

방법: 추가 기능 만들기

연습: 마법사 만들기

참조

작업 목록(Visual Studio)

개념

자동화 개체 모델 차트

기타 리소스

환경 창 만들기 및 제어

추가 기능 및 마법사 만들기

자동화 및 확장성 참조