IVsAddWebReferenceDlg3.ShowDiscoveredServicesInCurrentDialog(Int32, String[], String[], String, String) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Affiche la liste des services de Windows Communication Foundation (WCF) dans une boîte de dialogue Ajouter une référence de service.
public:
void ShowDiscoveredServicesInCurrentDialog(int cItems, cli::array <System::String ^> ^ ServiceUrls, cli::array <System::String ^> ^ ServiceDisplayNames, System::String ^ pszStatusText, System::String ^ pszErrorText);
public:
void ShowDiscoveredServicesInCurrentDialog(int cItems, Platform::Array <Platform::String ^> ^ ServiceUrls, Platform::Array <Platform::String ^> ^ ServiceDisplayNames, Platform::String ^ pszStatusText, Platform::String ^ pszErrorText);
void ShowDiscoveredServicesInCurrentDialog(int cItems, std::Array <std::wstring const &> const & ServiceUrls, std::Array <std::wstring const &> const & ServiceDisplayNames, std::wstring const & pszStatusText, std::wstring const & pszErrorText);
public void ShowDiscoveredServicesInCurrentDialog (int cItems, string[] ServiceUrls, string[] ServiceDisplayNames, string pszStatusText, string pszErrorText);
abstract member ShowDiscoveredServicesInCurrentDialog : int * string[] * string[] * string * string -> unit
Public Sub ShowDiscoveredServicesInCurrentDialog (cItems As Integer, ServiceUrls As String(), ServiceDisplayNames As String(), pszStatusText As String, pszErrorText As String)
Paramètres
- cItems
- Int32
Valeur de type long qui contient le nombre d’éléments à afficher.
- pszStatusText
- String
String qui contient le texte de l'état. Peut avoir la valeur null pour l’État par défaut.
Exemples
L’exemple suivant montre comment afficher des services dans la boîte de dialogue Ajouter une référence de service .
// 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.
);
}
Remarques
Utilisez cette méthode lorsque vous étendez le bouton découvrir dans la boîte de dialogue Ajouter une référence de service pour afficher les services retournés par votre code de découverte personnalisé.