共用方式為


IVsAddWebReferenceDlg3.ShowDiscoveredServicesInCurrentDialog 方法

顯示清單中的 Windows 通訊資格服務的加入服務參考對話方塊。

命名空間:  Microsoft.VisualStudio.WCFReference.Interop
組件:  Microsoft.VisualStudio.WCFReference.Interop (在 Microsoft.VisualStudio.WCFReference.Interop.dll 中)

語法

'宣告
Sub ShowDiscoveredServicesInCurrentDialog ( _
    cItems As Integer, _
    ServiceUrls As String(), _
    ServiceDisplayNames As String(), _
    pszStatusText As String, _
    pszErrorText As String _
)
void ShowDiscoveredServicesInCurrentDialog(
    int cItems,
    string[] ServiceUrls,
    string[] ServiceDisplayNames,
    string pszStatusText,
    string pszErrorText
)
void ShowDiscoveredServicesInCurrentDialog(
    [InAttribute] int cItems, 
    [InAttribute] array<String^>^ ServiceUrls, 
    [InAttribute] array<String^>^ ServiceDisplayNames, 
    [InAttribute] String^ pszStatusText, 
    [InAttribute] String^ pszErrorText
)
abstract ShowDiscoveredServicesInCurrentDialog : 
        cItems:int * 
        ServiceUrls:string[] * 
        ServiceDisplayNames:string[] * 
        pszStatusText:string * 
        pszErrorText:string -> unit
function ShowDiscoveredServicesInCurrentDialog(
    cItems : int, 
    ServiceUrls : String[], 
    ServiceDisplayNames : String[], 
    pszStatusText : String, 
    pszErrorText : String
)

參數

  • cItems
    類型:Int32

    A Long ,包含要顯示的項目數。

  • ServiceUrls
    類型:array<String[]

    A String陣列,包含 URL 位址的服務。

  • ServiceDisplayNames
    類型:array<String[]

    A String陣列,包含服務名稱。

  • pszStatusText
    類型:String

    A String所包含的狀態文字。 可能是Null的預設狀態。

  • pszErrorText
    類型:String

    A String ,包含錯誤文字。 Null如果沒有錯誤。

備註

當您擴充時,請使用這個方法探索 按鈕在 加入服務參考以顯示您的自訂探索程式碼所傳回的服務] 對話方塊。

範例

下列範例示範如何顯示服務在加入服務參考對話方塊。

// Ask Visual Studio what window to use as the dialog's owner.
IUIService uiservice = GetService(typeof(IUIService)) as IUIService;
IWin32Window ownerWindow = null;
if (uiservice != null)
{
    ownerWindow = uiservice.GetDialogOwnerWindow();
}

// Display the form and get the user input.
ServiceInfo[] services;
using (SearchForm form = new SearchForm())
{
    services = form.DiscoverServices(ownerWindow, uiservice);
}

if (services == null)
{
    // The user canceled the dialog.
    addWebReferenceDlg3.ShowDiscoveredServicesInCurrentDialog( 
        0, new string[] { }, new string[] { }, 
        Properties.Resources.SearchCanceled, // status text
        null  // Null means no errors occurred
        );
    return;
}
else
{
    // Build up an array of URLs and an array of display names.
    string[] serviceUrls = new string[services.Length];
    string[] serviceDisplayNames = new string[services.Length];
    for (int i = 0; i < services.Length; ++i)
    {
        serviceUrls[i] = services[i].Uri.AbsoluteUri;
        serviceDisplayNames[i] = services[i].DisplayName;
    }

    // And tell the Add Service Reference dialog to display them.
     addWebReferenceDlg3.ShowDiscoveredServicesInCurrentDialog( 
         services.Length, serviceUrls, serviceDisplayNames, 
         null, // Null means to use the default status text.
         null  // Null means no errors occurred.
         );
}

.NET Framework 安全性

請參閱

參考

IVsAddWebReferenceDlg3 介面

Microsoft.VisualStudio.WCFReference.Interop 命名空間