مشاركة عبر


كيفية القيام بما يلي: عنصر تحكم قائمة المهام

يمكن التحكم قائمة المهام ومحتوياته باستخدام "التنفيذ التلقائي". هو الممثلة في Visual Studioطراز التنفيذ التلقائي بواسطة الكائنات التالية ومجموعة.

اسم الكائن

الوصف

TaskListكائن

يمثل قائمة المهام .

TaskItemsمجموعة

يمثل الجميع المهام في قائمة المهام .

TaskItemكائن

يمثل مهمة واحدة العنصر في قائمة المهام.

TaskListEventsكائن

يسمح لك إلى الاستجابة إلى الأحداث التي تحدث في قائمة المهام.

بواسطة using these الكائنات و collections, you can:

  • قم بإنشاء عنصر مهمة و إضافة إلى قائمة المهام (Addأسلوب) أو حذفه من قائمة المهام (Deleteأسلوب).

  • الحصول على عناصر الموجودة حاليا في قائمة المهام (Selectأسلوب).

  • عرض مستند المقترن بعنصر مهمة ( Navigateأسلوب).

  • تحديد مهمة العنصر ( Selectالأسلوب).

  • استجابة عند تمت الإضافة عنصر مهمة، وإزالتها، وتعديلها، أو محدد ( TaskAdded، TaskRemoved، TaskModified، و TaskNavigatedالأحداث.)

بالإضافة إلى التحكم في المحتويات قائمة المهام ، يمكنك أيضا التحكم في الصفات المميزة لها، مثل العرض والارتفاع. لمزيد من المعلومات، راجع كيفية القيام بما يلي: الصفات المميزة لإطار تغيير.

ملاحظة

قد تختلف مربعات الحوار وأوامر القائمة التى تشاهدها الان عن تلك الموصوفة في التعليمات اعتماداً على الإعدادات النشطة أو الإصدار الخاص بك. تم تطوير هذه الإجراءات من خلال "إعدادات تطوير عام" النشط. To change your settings, choose Import and Export Settings on the Tools menu. لمزيد من المعلومات، راجع العمل مع إعدادات.

مثال

الوظيفة الإضافية يوضح المثال التالي كيفية الرجوع واستخدام الأعضاء طراز التنفيذ التلقائي مهمة قائمة مختلفة. هذا المثال إضافة مهام جديدة إلى قائمة المهام، قم بسرد عدد المهام، و ثم يقوم بحذف مهمة واحدة. قبل تشغيل المثال التالي، تحديد قائمة المهام من القائمةعرض . تظهر المهام في فئة Addin الإضافية ووحدات الماكرو.

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)

المبادئ

مخطط نموذج كائن تلقائي

موارد أخرى

إنشاء و التحكم في بيئة Windows

إنشاء إضافة-زر 'Ins' ومعالجات

التنفيذ التلقائي والمرجع الامتداد