Partilhar via


Método IVsAddWebReferenceDlg3.ShowDiscoveredServicesInCurrentDialog

Exibe uma lista dos serviços Windows Communication Foundation (WCF) em um Add Service Reference caixa de diálogo.

Namespace:  Microsoft.VisualStudio.WCFReference.Interop
Assembly:  Microsoft.VisualStudio.WCFReference.Interop (em Microsoft.VisualStudio.WCFReference.Interop.dll)

Sintaxe

'Declaração
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
)

Parâmetros

  • cItems
    Tipo: Int32

    A Long que contém o número de itens a serem exibidos.

  • ServiceUrls
    Tipo: array<String[]

    A String aborda o array que contém o URL para os serviços.

  • ServiceDisplayNames
    Tipo: array<String[]

    A String matriz que contém os nomes dos serviços.

  • pszStatusText
    Tipo: String

    A String que contém o texto de status. Pode ser Null para o status padrão.

  • pszErrorText
    Tipo: String

    A String que contém o texto de erro. NullCaso não tenha havido erros.

Comentários

Use esse método quando você estende o Discover botão no Add Service Reference caixa de diálogo para exibir retornados pelo seu código personalizado de descoberta de serviços.

Exemplos

O exemplo a seguir demonstra como exibir os serviços na Add Service Reference caixa de diálogo.

// 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.
         );
}

Segurança do .NET Framework

Consulte também

Referência

IVsAddWebReferenceDlg3 Interface

Namespace Microsoft.VisualStudio.WCFReference.Interop