IVsAddWebReferenceDlg3.ShowAddWebReferenceDialog Method
Displays the Add Service Reference dialog box.
Namespace: Microsoft.VisualStudio.WCFReference.Interop
Assembly: Microsoft.VisualStudio.WCFReference.Interop (in Microsoft.VisualStudio.WCFReference.Interop.dll)
Syntax
'Declaration
Sub ShowAddWebReferenceDialog ( _
pProject As IVsHierarchy, _
pDiscoverySession As IDiscoverySession, _
referenceTypesAllowed As ServiceReferenceType, _
pszDialogName As String, _
pExistingReferenceGroup As IVsWCFReferenceGroup, _
pszReferenceConfigContents As String, _
<OutAttribute> ByRef ppReferenceResult As IVsAddWebReferenceResult, _
<OutAttribute> ByRef pfCancelled As Integer _
)
void ShowAddWebReferenceDialog(
IVsHierarchy pProject,
IDiscoverySession pDiscoverySession,
ServiceReferenceType referenceTypesAllowed,
string pszDialogName,
IVsWCFReferenceGroup pExistingReferenceGroup,
string pszReferenceConfigContents,
out IVsAddWebReferenceResult ppReferenceResult,
out int pfCancelled
)
void ShowAddWebReferenceDialog(
[InAttribute] IVsHierarchy^ pProject,
[InAttribute] IDiscoverySession^ pDiscoverySession,
[InAttribute] ServiceReferenceType referenceTypesAllowed,
[InAttribute] String^ pszDialogName,
[InAttribute] IVsWCFReferenceGroup^ pExistingReferenceGroup,
[InAttribute] String^ pszReferenceConfigContents,
[OutAttribute] IVsAddWebReferenceResult^% ppReferenceResult,
[OutAttribute] int% pfCancelled
)
abstract ShowAddWebReferenceDialog :
pProject:IVsHierarchy *
pDiscoverySession:IDiscoverySession *
referenceTypesAllowed:ServiceReferenceType *
pszDialogName:string *
pExistingReferenceGroup:IVsWCFReferenceGroup *
pszReferenceConfigContents:string *
ppReferenceResult:IVsAddWebReferenceResult byref *
pfCancelled:int byref -> unit
function ShowAddWebReferenceDialog(
pProject : IVsHierarchy,
pDiscoverySession : IDiscoverySession,
referenceTypesAllowed : ServiceReferenceType,
pszDialogName : String,
pExistingReferenceGroup : IVsWCFReferenceGroup,
pszReferenceConfigContents : String,
ppReferenceResult : IVsAddWebReferenceResult,
pfCancelled : int
)
Parameters
pProject
Type: Microsoft.VisualStudio.Shell.Interop.IVsHierarchyThe IVsHierarchy for the project where the reference will be added.
pDiscoverySession
Type: Microsoft.VisualStudio.Shell.Interop.IDiscoverySessionThe IVsDiscoveryService session to use for the metadata download.
referenceTypesAllowed
Type: Microsoft.VisualStudio.WCFReference.Interop.ServiceReferenceTypeThe ServiceReferenceType for the reference; either Windows Communication Foundation (WCF) or or Web services (ASMX) that use ASP.NET.
pszDialogName
Type: StringA String that contains the title for the dialog box. Can be Null.
pExistingReferenceGroup
Type: Microsoft.VisualStudio.WCFReference.Interop.IVsWCFReferenceGroupAn existing IVsWCFReferenceGroup. Can be Null.
pszReferenceConfigContents
Type: StringA String that contains the configuration contents.
ppReferenceResult
Type: Microsoft.VisualStudio.WCFReference.Interop.IVsAddWebReferenceResult%A IVsAddWebReferenceResult object that contains the results. Can be Null if the dialog box was canceled.
pfCancelled
Type: Int32%An Integer specifying whether the dialog box was canceled.
Remarks
The Add Service Reference dialog box allows a user to specify a metadata download address, downloads the service metadata, and displays information about the service.
If the service metadata download is successful and the user closes the dialog box by clicking OK, the consumer of the service (for example the project system) should call the Save method of the returned IVsAddWebReferenceResult object. This causes a new WCF reference to be added to the project and the service proxy to be generated. The IVsAddWebReferenceResult object can also be cached and used to create a service reference later.
ShowAddWebReferenceDialog fails immediately if the project does not support storage service, or VSPROPID_ServiceReferenceSupported property of the project is not true.
Examples
The following example demonstrates how to display the Add Service Reference dialog box.
/// Add a service reference to the given project.
private static IVsWCFReferenceGroup TryAddServiceReference
(IVsHierarchy hierarchy, IServiceProvider serviceProvider,
IDiscoverySession discoverySession)
{
Debug.Assert(serviceProvider != null, "Why are we passing in a NULL
service provider to a private method?");
IVsAddWebReferenceDlg3 awrdlg =
serviceProvider.GetService(typeof(SVsAddWebReferenceDlg3))
as IVsAddWebReferenceDlg3;
IVsAddWebReferenceResult addWebReferenceResult = null;
int cancelled = 1;
if (awrdlg != null && hierarchy != null)
{
awrdlg.ShowAddWebReferenceDialog(
hierarchy,
discoverySession,
ServiceReferenceType.SRT_WCFReference,
null,
null,
null,
out addWebReferenceResult,
out cancelled);
}
if (addWebReferenceResult != null && cancelled == 0)
{
return addWebReferenceResult.Save() as IVsWCFReferenceGroup;
}
else
{
return null;
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.