مشاركة عبر


كيفية القيام بما يلي: التحكم في مستكشف الحل

مستكشف الحل هو نافذة أداة في Visual Studioالمتكاملة (IDE) ذلك dهوplays لبيئة التطوير محتويات أحد الحلول، والذي يتضمن مشاريع الخاصة بالحل وعناصر كل مشروع. في إطارات الأدوات الأخرى في Visual Studio، يمكنك التحكم بها المعلمات الفعلية، مثل الحجم، والموقع، وما إذا كان ذلك هو رأس أو عائم حر. لمعلومات حول كيفية إلى التعامل مع هذا النافذة إلى ol بالإضافة إلى النافذةات Visual Studioإلى ol الأخرى، راجع كيفية القيام بما يلي: الصفات المميزة لإطار تغيير.

مستكشف الحلول لا يحتوي على الكائنات "التنفيذ التلقائي الخاصة به ك، ولكن يمكنك عنصر تحكم محتويات هيكلي الخاص به إلى حدود معينة باستخدام UIHierarchy. إلى عنصر تحكم مشاريع وعناصر مشروع في الحل، باستخدام طراز التنفيذ التلقائي للمشروع. لمزيد من المعلومات، راجع التحكم في مشاريع و حلول.

ملاحظة

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

إلى التحكم في "مستكشف الحلول" باستخدام UIHierarchy

  1. إذا ليس الحل Explorer مرئي بالفعل، انقر فوق مستكشف الحل من القائمةعرض .

  2. قم بفتح مشروع الذي يحتوي على عدد كبير من العناصر، مثل إضافة-في المشروع.

  3. في مستكشف الحل ، انقر فوق عقدة له منخفض-nodes الثاني على الأقل.

  4. قم بتشغيل تعليمات برمجية التالية.

مثال

يوضح هذا المثال كيفية إلى معالجة من مستكشف الحل باستخدام UIHierarchy.

Imports System.Text
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.
    slnExplUIHierarchyExample(_applicationObject)
End Sub

Sub slnExplUIHierarchyExample(ByVal dte As DTE2)
    Dim UIH As UIHierarchy = dte.ToolWindows.SolutionExplorer
    ' Requires a reference to System.Text.
    ' Set a reference to the first level nodes in Solution Explorer. 
    ' Automation collections are one-based.
    Dim UIHItem As UIHierarchyItem = UIH.UIHierarchyItems.Item(1)
    Dim file As UIHierarchyItem
    Dim sb As New StringBuilder

    ' Iterate through first level nodes.
    For Each file In UIHItem.UIHierarchyItems
        sb.AppendLine(file.Name)
        ' Iterate through second level nodes (if they exist).
        Dim subitem As UIHierarchyItem
        For Each subitem In file.UIHierarchyItems
            sb.AppendLine("   " & subitem.Name)
            ' Iterate through third level nodes (if they exist).
            Dim subSubItem As UIHierarchyItem
            For Each subSubItem In subitem.UIHierarchyItems
                sb.AppendLine("        " & subSubItem.Name)
            Next
        Next
    Next
    MsgBox(sb.ToString)
 End Sub
using System.Text;
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.
    slnExplUIHierarchyExample(_applicationObject);
}

public void slnExplUIHierarchyExample(DTE2 dte)
{
    UIHierarchy UIH = dte.ToolWindows.SolutionExplorer;
    // Requires a reference to System.Text.
    // Set a reference to the first level nodes in Solution Explorer. 
    // Automation collections are one-based.
    UIHierarchyItem UIHItem = UIH.UIHierarchyItems.Item(1);
    StringBuilder sb = new StringBuilder();

    // Iterate through first level nodes.
    foreach ( UIHierarchyItem fid in UIHItem.UIHierarchyItems )
    {
        sb.AppendLine(fid.Name);
        // Iterate through second level nodes (if they exist).
        foreach ( UIHierarchyItem subitem in fid.UIHierarchyItems )
        {
            sb.AppendLine("   "+subitem.Name);
            // Iterate through third level nodes (if they exist).
            foreach ( UIHierarchyItem subSubItem in 
              subitem.UIHierarchyItems )
            {
                sb.AppendLine("        "+subSubItem.Name);
            }
        }
    }
    System.Windows.Forms.MessageBox.Show(sb.ToString());
}

راجع أيضًا:

المهام

كيفية القيام بما يلي: قم بإنشاء إضافة-في

الإرشادات التفصيلية: إنشاء معالج

المبادئ

مقدمة إلى كائن VSProject2

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

موارد أخرى

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

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

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