مشاركة عبر


مثال للتحديد WindowConfiguration

لاستخدام المحتوى مثبت لتثبيت s مكوّن مجتمع الخاص بك، يجب عليك إنشاء ملف.vscontent مكوّن. بعد إنشاء الملف.vscontent، يضغط مكوّن ملفات و.vscontent الملف إلى ملف.zip ثم قم بتغيير ملحق اسم الملف من.zip إلى.vsi. يمكنك ثم توزيعها.vsi ملف للمطورين الآخرين باستخدام أي أسلوب اتخاذ قرار، مثل إجراء ملف متوفر للتنزيل من الويب، إرسال ملف كمرفق بريد إلكتروني، أو نشرها ملف تشغيل يجعله مشتركًا شبكة اتصال.Visual Studio ملفات.Vscontent استخدام ملفات.Vscontent XML الذي يستند إلى لوصف المكونات التي قمت بإنشائها و ترغب في المشاركة.

حد أدنى، الملف.vscontent تعرف نوع مكونات والإصدار OnConnectionالتي يجب استخدامها في componens مع. بعد التي قمت بكتابة ملف.vscontent، يمكنك إنشاء الملف.vsi التي سوف يستخدم "مثبت المحتوى" إلى يثّبت المكونات تشغيل جهاز الكمبيوتر الخاص بالمطور. إلى إنشاء ملف.vscontent أساسيةكيفية القيام بما يلي: ترجمة و تشغيل أمثلة تعليمات برمجية طراز كائن للتنفيذ التلقائي

المثال

Sub WinConfigExample2a(ByVal dte As DTE)
    Dim colWinConfig As WindowConfigurations = dte.WindowConfigurations
    Dim objWinConfig As WindowConfiguration

    MsgBox("Taking snapshot of current window configuration... ")
    objWinConfig = colWinConfig.Add("Layout_1")
    MsgBox("Created new configuration: " & _
    colWinConfig.Item(colWinConfig.Count).Name)
    FillMsg(colWinConfig)
End Sub

Sub WinConfigExample2b(ByVal dte As DTE)
    ' Before running this, alter the current window configuration.
    Dim colWinConfig As WindowConfigurations = dte.WindowConfigurations
    Dim objWinConfig As WindowConfiguration
    Dim lCtr As Integer

    ' Create another new window configuration.
    MsgBox("Now we'll save the new configuration...")
    objWinConfig = colWinConfig.Add("Layout_2")

    MsgBox("Created new configuration: " & _
    colWinConfig.Item(colWinConfig.Count).Name)
    FillMsg(colWinConfig)
    MsgBox("Now we'll load and apply the Layout_1 configuration." & _
    vbCr & "You should see the windows change back.")
    colWinConfig.Item(colWinConfig.Count - 1).Apply()
    MsgBox("Now we'll change back to Layout_2...")
    colWinConfig.Item(colWinConfig.Count).Apply()

    ' Delete both new window configurations.
    colWinConfig.Item(3).Apply()
    For lCtr = (colWinConfig.Count - 1) To (colWinConfig.Count)
        objWinConfig = colWinConfig.Item(colWinConfig.Count)
        objWinConfig.Delete()
        FillMsg(colWinConfig)
    Next lCtr
 End Sub

Sub FillMsg(ByVal colWinConfig As Object)
    ' Lists all currently available named window configurations.
    Dim lCtr As Integer
    Dim strMsg As String

    For lCtr = 1 To colWinConfig.count
        strMsg = strMsg & "Configuration name " & lCtr & ": " & _
        colWinConfig.Item(lCtr).Name & vbCr
    Next lCtr
    strMsg = "Current Configurations: " & vbCr & strMsg
    MsgBox(strMsg)
End Sub
void WinConfigExample2a(_DTE dte)
{
    WindowConfigurations colWinConfig = dte.WindowConfigurations;
    WindowConfiguration objWinConfig;

    MessageBox.Show("Taking snapshot of current window 
    configuration... ");
    objWinConfig = colWinConfig.Add("Layout_1");
    MessageBox.Show("Created new configuration: " + 
    colWinConfig.Item(colWinConfig.Count).Name);
    FillMsg(colWinConfig);
}

void WinConfigExample2b(_DTE dte)
{
    // Before running this, alter the current window configuration.
    WindowConfigurations colWinConfig = dte.WindowConfigurations;
    WindowConfiguration objWinConfig; 
    int lCtr;

    // Create another new window configuration.
    MessageBox.Show("Now we'll save the new configuration...");
    objWinConfig = colWinConfig.Add("Layout_2");

    MessageBox.Show("Created new configuration: " + 
    colWinConfig.Item(colWinConfig.Count).Name);
    FillMsg(colWinConfig);
    MessageBox.Show("Now we'll load and apply the Layout_1 
    configuration. \n You should see the windows change back.");
    colWinConfig.Item(colWinConfig.Count - 1).Apply(true);
    MessageBox.Show("Now we'll change back to Layout_2...");
    colWinConfig.Item(colWinConfig.Count).Apply(true);

    // Delete both new window configurations.
    colWinConfig.Item(3).Apply(true);
    for (lCtr = (colWinConfig.Count - 1); lCtr < (colWinConfig.Count 
    +1); lCtr++)
    {
        objWinConfig = colWinConfig.Item(colWinConfig.Count);
        objWinConfig.Delete();
        FillMsg(colWinConfig);
    }
}

void FillMsg(WindowConfigurations colWinConfig )
{
    // Lists all currently available named window configurations.
    int lCtr;
    string strMsg = null;

    for (lCtr = 1; lCtr < colWinConfig.Count + 1; lCtr ++)
    {
    strMsg = strMsg + "Configuration name " + lCtr + ": " + _
    colWinConfig.Item(lCtr).Name + "\n"; 
    }
    strMsg = "Current Configurations: \n" + strMsg;
    MessageBox.Show(strMsg);
}

راجع أيضًا:

المرجع

WindowConfiguration

WindowConfigurations