/Branches/V1/Thinktecture.Tools.Web.Services.WsdlWizard/WsdlWizardForm.cs
C# | 3476 lines | 2576 code | 323 blank | 577 comment | 177 complexity | 47c07a079c8fb78a5dc1da4d2fcbf350 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Globalization;
- using System.Linq;
- using System.Windows.Forms;
- using System.IO;
- using System.Text;
- using System.Reflection;
- using System.Net;
- using Thinktecture.Tools.Web.Services.ServiceDescription;
- using WizardControl;
- using WRM.Windows.Forms;
- using Message = Thinktecture.Tools.Web.Services.ServiceDescription.Message;
- using Thinktecture.Tools.Web.Services.Wscf.Environment;
-
- namespace Thinktecture.Tools.Web.Services.WsdlWizard
- {
- /// <summary>
- /// Represents the user interface handler for WsdlWizardForm.
- /// </summary>
- public class WsdlWizardForm : Form
- {
- #region Private fields
-
- private int operationCount;
- private string schemaLocation = "";
- private string wsdlLocation = "";
- private string schemaNamespace = "";
- private bool openCodeGenDialog;
- private bool alreadyCancelled = false;
- private bool roundtripMode = false;
-
- private string currentFolder;
- private string wsdlFile = string.Empty;
- private string defaultPathForImports = string.Empty;
- private string projectRootDirectory = string.Empty;
-
- private ArrayList importedSchemaNamespaces = new ArrayList();
-
- private Wizard wsdlWizardCtrl;
- private WizardPage wizardPageBasicMetadata;
- private TextBox tbServiceName;
- private Label lblServiceName;
- private Label lblNamespace;
- private WizardPage wizardPageOperationsList;
- private GroupBox groupBox1;
- private TextBox tbEdit;
- private ComboBox cbMEPs;
- private Panel panel1;
- private ToolTip toolTip1;
- private IContainer components;
- private TextBox tbNamespace;
- private LinkLabel llAddOperation;
- private EditableListView operationsListView;
- private InterfaceContract serviceInterfaceContract;
- private InterfaceContract importedContract = null;
- private SchemaElements messageSchemas = new SchemaElements();
- private SchemaElements headerSchemas = new SchemaElements();
- private SchemaElements faultSchemas = new SchemaElements();
- private LinkLabel llRemoveOperation;
- private Label lblServiceDoc;
- private TextBox tbServiceDoc;
- private WizardPage wizardPageMessageMapping;
- private WizardControl.WizardPage wizardPageAdditionalOptions;
- private System.Windows.Forms.CheckBox cbNeedsServiceElement;
- private System.Windows.Forms.CheckBox cbCodeGenDialog;
- private WRM.Windows.Forms.PropertyTree ptvServiceOperations;
- private WizardControl.WizardPage wizardPageSchemaImports;
- private System.Windows.Forms.GroupBox groupBox2;
- private Thinktecture.Tools.Web.Services.WsdlWizard.EditableListView importsListView;
- private System.Windows.Forms.LinkLabel llAddImport;
- private System.Windows.Forms.LinkLabel llRemoveImport;
- private System.Windows.Forms.OpenFileDialog openFileDialog1;
- private WizardControl.WizardPage wizardPageAlternativeXSDPaths;
- private Thinktecture.Tools.Web.Services.WsdlWizard.EditableListView xsdpathsListView;
- private System.Windows.Forms.ToolTip toolTipPath;
- private System.Windows.Forms.CheckBox cbInfer;
- private OperationsCollection inferOperations = new OperationsCollection(10);
- private CheckBox cbSoap12;
- private CheckBox cbSoap11;
- private OperationsCollection oldOperations =
- new OperationsCollection(); // Holds a list of old operations configured by the user.
-
- #endregion
-
- #region Public properties.
-
- /// <summary>
- /// Gets a value indicating whether the code generation dialog should be opened or not.
- /// </summary>
- public bool OpenCodeGenDialog
- {
- get { return openCodeGenDialog; }
- }
-
- /// <summary>
- /// Gets or sets the location to create the WSDL file.
- /// </summary>
- public string WsdlLocation
- {
- get { return wsdlLocation; }
- set { wsdlLocation = value; }
- }
-
- /// <summary>
- /// Gets or sets the schema namespace.
- /// </summary>
- public string SchemaNamespace
- {
- get { return schemaNamespace; }
- set { schemaNamespace = value; }
- }
-
- /// <summary>
- /// Gets or sets the schema location.
- /// </summary>
- public string SchemaLocation
- {
- get { return schemaLocation; }
- set
- {
- schemaLocation = value;
- this.UpdateCurrentFolder(schemaLocation);
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether the round tripping mode is on or off.
- /// </summary>
- public bool RoundtripMode
- {
- get { return roundtripMode; }
- set { roundtripMode = value; }
- }
-
- /// <summary>
- /// Gets or sets the default path for the imported XSD files.
- /// </summary>
- public string DefaultPathForImports
- {
- get { return defaultPathForImports; }
- set { defaultPathForImports = value; }
- }
-
- /// <summary>
- /// Gets or sets the root directory for the project.
- /// </summary>
- public string ProjectRootDirectory
- {
- get { return projectRootDirectory; }
- set { projectRootDirectory = value; }
- }
-
- #endregion
-
- #region Constructors
-
- /// <summary>
- /// Initializes a new instance of WsdlWizardForm class with the specified values.
- /// </summary>
- /// <param name="xsdLocation">
- /// Location of the XSD file containing the message contract definitions for the WSDL.
- /// </param>
- public WsdlWizardForm(string xsdLocation)
- {
- //
- // Required for Windows Form Designer support.
- //
- InitializeComponent();
-
- schemaLocation = xsdLocation;
- this.UpdateCurrentFolder(schemaLocation);
-
- serviceInterfaceContract = new InterfaceContract();
- serviceInterfaceContract.SchemaNamespace = schemaLocation;
- }
-
- /// <summary>
- /// Initializes a new instance of WsdlWizardForm class with the specified values.
- /// </summary>
- /// <param name="wsdlLocation">Location of the WSDL file to modify.</param>
- /// <param name="roundTripping">
- /// Value indicating that the round tripping is required.
- /// </param>
- /// <remarks>
- /// The roundTripping parameter must be set to true in order to use the round tripping feature.
- /// </remarks>
- public WsdlWizardForm(string wsdlLocation, bool roundTripping)
- {
- //
- // Required for Windows Form Designer support.
- //
- InitializeComponent();
-
- // Import the interface contract from the selected WSDL file.
- try
- {
- this.importedContract =
- ServiceDescriptionEngine.GetInterfaceContract(wsdlLocation);
- this.wsdlFile = wsdlLocation;
- }
- catch(WsdlModifiedException ex)
- {
- throw new WsdlFileLoadException(
- "Could not import the specified WSDL file for round-triping.\nThis file is not compatible for round-tripping.", ex);
- }
- catch(WsdlNotCompatibleForRoundTrippingException ex)
- {
- throw new WsdlFileLoadException(
- "Could not import the specified WSDL file for round-triping.\nThis file is not compatible for round-tripping.", ex);
- }
- catch
- {
- throw new WsdlFileLoadException(
- "System could not import the specified WSDL file for round triping.\nThis file is either modified or not a valid WSDL file created using WSCF.exe.");
- }
-
- this.UpdateCurrentFolder(wsdlLocation);
- serviceInterfaceContract = new InterfaceContract();
- serviceInterfaceContract.SchemaNamespace = schemaLocation;
- this.roundtripMode = roundTripping;
- }
-
- #endregion
-
- #region Dispose
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
-
- #endregion
-
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WsdlWizardForm));
- this.wsdlWizardCtrl = new WizardControl.Wizard();
- this.wizardPageBasicMetadata = new WizardControl.WizardPage();
- this.tbServiceDoc = new System.Windows.Forms.TextBox();
- this.lblServiceDoc = new System.Windows.Forms.Label();
- this.lblNamespace = new System.Windows.Forms.Label();
- this.tbNamespace = new System.Windows.Forms.TextBox();
- this.lblServiceName = new System.Windows.Forms.Label();
- this.tbServiceName = new System.Windows.Forms.TextBox();
- this.wizardPageSchemaImports = new WizardControl.WizardPage();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.llRemoveImport = new System.Windows.Forms.LinkLabel();
- this.llAddImport = new System.Windows.Forms.LinkLabel();
- this.importsListView = new Thinktecture.Tools.Web.Services.WsdlWizard.EditableListView();
- this.wizardPageOperationsList = new WizardControl.WizardPage();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.operationsListView = new Thinktecture.Tools.Web.Services.WsdlWizard.EditableListView();
- this.llAddOperation = new System.Windows.Forms.LinkLabel();
- this.llRemoveOperation = new System.Windows.Forms.LinkLabel();
- this.cbInfer = new System.Windows.Forms.CheckBox();
- this.panel1 = new System.Windows.Forms.Panel();
- this.tbEdit = new System.Windows.Forms.TextBox();
- this.cbMEPs = new System.Windows.Forms.ComboBox();
- this.wizardPageMessageMapping = new WizardControl.WizardPage();
- this.ptvServiceOperations = new WRM.Windows.Forms.PropertyTree();
- this.wizardPageAdditionalOptions = new WizardControl.WizardPage();
- this.cbSoap12 = new System.Windows.Forms.CheckBox();
- this.cbSoap11 = new System.Windows.Forms.CheckBox();
- this.cbNeedsServiceElement = new System.Windows.Forms.CheckBox();
- this.cbCodeGenDialog = new System.Windows.Forms.CheckBox();
- this.wizardPageAlternativeXSDPaths = new WizardControl.WizardPage();
- this.xsdpathsListView = new Thinktecture.Tools.Web.Services.WsdlWizard.EditableListView();
- this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
- this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
- this.toolTipPath = new System.Windows.Forms.ToolTip(this.components);
- this.wsdlWizardCtrl.SuspendLayout();
- this.wizardPageBasicMetadata.SuspendLayout();
- this.wizardPageSchemaImports.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.wizardPageOperationsList.SuspendLayout();
- this.groupBox1.SuspendLayout();
- this.panel1.SuspendLayout();
- this.wizardPageMessageMapping.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.ptvServiceOperations)).BeginInit();
- this.wizardPageAdditionalOptions.SuspendLayout();
- this.wizardPageAlternativeXSDPaths.SuspendLayout();
- this.SuspendLayout();
- //
- // wsdlWizardCtrl
- //
- this.wsdlWizardCtrl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.wsdlWizardCtrl.BannerBitmap = ((System.Drawing.Image)(resources.GetObject("wsdlWizardCtrl.BannerBitmap")));
- this.wsdlWizardCtrl.CloseForm = false;
- this.wsdlWizardCtrl.Controls.Add(this.wizardPageBasicMetadata);
- this.wsdlWizardCtrl.Controls.Add(this.wizardPageSchemaImports);
- this.wsdlWizardCtrl.Controls.Add(this.wizardPageOperationsList);
- this.wsdlWizardCtrl.Controls.Add(this.wizardPageMessageMapping);
- this.wsdlWizardCtrl.Controls.Add(this.wizardPageAdditionalOptions);
- this.wsdlWizardCtrl.Controls.Add(this.wizardPageAlternativeXSDPaths);
- this.wsdlWizardCtrl.Location = new System.Drawing.Point(0, 0);
- this.wsdlWizardCtrl.Name = "wsdlWizardCtrl";
- this.wsdlWizardCtrl.Size = new System.Drawing.Size(497, 360);
- this.wsdlWizardCtrl.TabIndex = 0;
- this.wsdlWizardCtrl.Title = "Generate WSDL";
- this.wsdlWizardCtrl.WelcomeBitmap = ((System.Drawing.Image)(resources.GetObject("wsdlWizardCtrl.WelcomeBitmap")));
- this.wsdlWizardCtrl.WelcomeText = resources.GetString("wsdlWizardCtrl.WelcomeText");
- this.wsdlWizardCtrl.Load += new System.EventHandler(this.wsdlWizardCtrl_Load);
- this.wsdlWizardCtrl.Cancelled += new WizardControl.Wizard.CancelledEventHandler(this.wsdlWizardCtrl_Cancelled);
- this.wsdlWizardCtrl.BeforeSummaryPageDisplayed += new WizardControl.Wizard.BeforeSummaryPageDisplayedEventHandler(this.wsdlWizardCtrl_BeforeSummaryPageDisplayed);
- this.wsdlWizardCtrl.BeforePageDisplayed += new WizardControl.Wizard.BeforePageDisplayedEventHandler(this.wsdlWizardCtrl_BeforePageDisplayed);
- this.wsdlWizardCtrl.Finished += new WizardControl.Wizard.FinishedEventHandler(this.wsdlWizardCtrl_Finished);
- this.wsdlWizardCtrl.AfterPageDisplayed += new WizardControl.Wizard.AfterPageDisplayedEventHandler(this.wsdlWizardCtrl_AfterPageDisplayed);
- this.wsdlWizardCtrl.ValidatePage += new WizardControl.Wizard.ValidatePageEventHandler(this.wsdlWizardCtrl_ValidatePage);
- //
- // wizardPageBasicMetadata
- //
- this.wizardPageBasicMetadata.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.wizardPageBasicMetadata.Controls.Add(this.tbServiceDoc);
- this.wizardPageBasicMetadata.Controls.Add(this.lblServiceDoc);
- this.wizardPageBasicMetadata.Controls.Add(this.lblNamespace);
- this.wizardPageBasicMetadata.Controls.Add(this.tbNamespace);
- this.wizardPageBasicMetadata.Controls.Add(this.lblServiceName);
- this.wizardPageBasicMetadata.Controls.Add(this.tbServiceName);
- this.wizardPageBasicMetadata.Description = "Please enter the name and the XML namespace of the Web Service.";
- this.wizardPageBasicMetadata.Heading = "Step 1: Specify your Web Service\'s basic settings";
- this.wizardPageBasicMetadata.Location = new System.Drawing.Point(21, 71);
- this.wizardPageBasicMetadata.Name = "wizardPageBasicMetadata";
- this.wizardPageBasicMetadata.Size = new System.Drawing.Size(456, 230);
- this.wizardPageBasicMetadata.TabIndex = 0;
- //
- // tbServiceDoc
- //
- this.tbServiceDoc.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.tbServiceDoc.Location = new System.Drawing.Point(120, 72);
- this.tbServiceDoc.Multiline = true;
- this.tbServiceDoc.Name = "tbServiceDoc";
- this.tbServiceDoc.Size = new System.Drawing.Size(312, 88);
- this.tbServiceDoc.TabIndex = 5;
- //
- // lblServiceDoc
- //
- this.lblServiceDoc.Location = new System.Drawing.Point(24, 72);
- this.lblServiceDoc.Name = "lblServiceDoc";
- this.lblServiceDoc.Size = new System.Drawing.Size(100, 23);
- this.lblServiceDoc.TabIndex = 4;
- this.lblServiceDoc.Text = "Documentation:";
- //
- // lblNamespace
- //
- this.lblNamespace.Location = new System.Drawing.Point(24, 40);
- this.lblNamespace.Name = "lblNamespace";
- this.lblNamespace.Size = new System.Drawing.Size(96, 23);
- this.lblNamespace.TabIndex = 3;
- this.lblNamespace.Text = "XML namespace:";
- //
- // tbNamespace
- //
- this.tbNamespace.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.tbNamespace.Location = new System.Drawing.Point(120, 40);
- this.tbNamespace.Name = "tbNamespace";
- this.tbNamespace.Size = new System.Drawing.Size(312, 20);
- this.tbNamespace.TabIndex = 2;
- //
- // lblServiceName
- //
- this.lblServiceName.Location = new System.Drawing.Point(24, 8);
- this.lblServiceName.Name = "lblServiceName";
- this.lblServiceName.Size = new System.Drawing.Size(88, 23);
- this.lblServiceName.TabIndex = 1;
- this.lblServiceName.Text = "Service name:";
- this.toolTip1.SetToolTip(this.lblServiceName, "\'Service name\' specifies the name of the Web Service binding to be generated. Thi" +
- "s will be the e.g. the class name for your Web Service proxy when generated from" +
- " the service description.");
- //
- // tbServiceName
- //
- this.tbServiceName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.tbServiceName.Location = new System.Drawing.Point(120, 6);
- this.tbServiceName.Name = "tbServiceName";
- this.tbServiceName.Size = new System.Drawing.Size(312, 20);
- this.tbServiceName.TabIndex = 0;
- this.toolTip1.SetToolTip(this.tbServiceName, "\'Service name\' specifies the name of the Web Service binding to be generated. Thi" +
- "s will be the e.g. the class name for your Web Service proxy when generated from" +
- " the service description.");
- //
- // wizardPageSchemaImports
- //
- this.wizardPageSchemaImports.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.wizardPageSchemaImports.Controls.Add(this.groupBox2);
- this.wizardPageSchemaImports.Cursor = System.Windows.Forms.Cursors.Default;
- this.wizardPageSchemaImports.Description = "Please add additional message schemas from XSD files as appropriate.";
- this.wizardPageSchemaImports.Heading = "Step 2: Specify additional message schemas";
- this.wizardPageSchemaImports.Location = new System.Drawing.Point(21, 71);
- this.wizardPageSchemaImports.Name = "wizardPageSchemaImports";
- this.wizardPageSchemaImports.Size = new System.Drawing.Size(456, 230);
- this.wizardPageSchemaImports.TabIndex = 2;
- //
- // groupBox2
- //
- this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox2.Controls.Add(this.llRemoveImport);
- this.groupBox2.Controls.Add(this.llAddImport);
- this.groupBox2.Controls.Add(this.importsListView);
- this.groupBox2.Location = new System.Drawing.Point(8, 3);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(440, 224);
- this.groupBox2.TabIndex = 2;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "XSD Imports:";
- //
- // llRemoveImport
- //
- this.llRemoveImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.llRemoveImport.Location = new System.Drawing.Point(95, 205);
- this.llRemoveImport.Name = "llRemoveImport";
- this.llRemoveImport.Size = new System.Drawing.Size(100, 16);
- this.llRemoveImport.TabIndex = 4;
- this.llRemoveImport.TabStop = true;
- this.llRemoveImport.Text = "Remove import";
- this.llRemoveImport.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llRemoveImport_LinkClicked);
- //
- // llAddImport
- //
- this.llAddImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.llAddImport.Location = new System.Drawing.Point(8, 205);
- this.llAddImport.Name = "llAddImport";
- this.llAddImport.Size = new System.Drawing.Size(81, 15);
- this.llAddImport.TabIndex = 3;
- this.llAddImport.TabStop = true;
- this.llAddImport.Text = "Add import";
- this.llAddImport.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llAddImport_LinkClicked);
- //
- // importsListView
- //
- this.importsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.importsListView.DisabledColumns = ((System.Collections.ArrayList)(resources.GetObject("importsListView.DisabledColumns")));
- this.importsListView.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.importsListView.FullRowSelect = true;
- this.importsListView.GridLines = true;
- this.importsListView.Location = new System.Drawing.Point(8, 16);
- this.importsListView.Name = "importsListView";
- this.importsListView.Size = new System.Drawing.Size(424, 184);
- this.importsListView.TabIndex = 2;
- this.importsListView.UseCompatibleStateImageBehavior = false;
- this.importsListView.View = System.Windows.Forms.View.Details;
- this.importsListView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.importsListView_MouseMove);
- //
- // wizardPageOperationsList
- //
- this.wizardPageOperationsList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.wizardPageOperationsList.Controls.Add(this.groupBox1);
- this.wizardPageOperationsList.Controls.Add(this.panel1);
- this.wizardPageOperationsList.Description = "Please add operations to the Web Service as needed.";
- this.wizardPageOperationsList.Heading = "Step 3: Specify settings for your Web Service\'s operations.";
- this.wizardPageOperationsList.Location = new System.Drawing.Point(21, 71);
- this.wizardPageOperationsList.Name = "wizardPageOperationsList";
- this.wizardPageOperationsList.Size = new System.Drawing.Size(456, 230);
- this.wizardPageOperationsList.TabIndex = 1;
- //
- // groupBox1
- //
- this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox1.Controls.Add(this.operationsListView);
- this.groupBox1.Controls.Add(this.llAddOperation);
- this.groupBox1.Controls.Add(this.llRemoveOperation);
- this.groupBox1.Controls.Add(this.cbInfer);
- this.groupBox1.Location = new System.Drawing.Point(8, 3);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(440, 224);
- this.groupBox1.TabIndex = 4;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "Operations:";
- //
- // operationsListView
- //
- this.operationsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.operationsListView.DisabledColumns = ((System.Collections.ArrayList)(resources.GetObject("operationsListView.DisabledColumns")));
- this.operationsListView.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.operationsListView.FullRowSelect = true;
- this.operationsListView.GridLines = true;
- this.operationsListView.Location = new System.Drawing.Point(8, 16);
- this.operationsListView.Name = "operationsListView";
- this.operationsListView.Size = new System.Drawing.Size(424, 184);
- this.operationsListView.TabIndex = 0;
- this.operationsListView.UseCompatibleStateImageBehavior = false;
- this.operationsListView.View = System.Windows.Forms.View.Details;
- //
- // llAddOperation
- //
- this.llAddOperation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.llAddOperation.Location = new System.Drawing.Point(7, 205);
- this.llAddOperation.Name = "llAddOperation";
- this.llAddOperation.Size = new System.Drawing.Size(81, 15);
- this.llAddOperation.TabIndex = 1;
- this.llAddOperation.TabStop = true;
- this.llAddOperation.Text = "Add operation";
- this.llAddOperation.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llAddItem_LinkClicked);
- //
- // llRemoveOperation
- //
- this.llRemoveOperation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.llRemoveOperation.Location = new System.Drawing.Point(95, 205);
- this.llRemoveOperation.Name = "llRemoveOperation";
- this.llRemoveOperation.Size = new System.Drawing.Size(100, 16);
- this.llRemoveOperation.TabIndex = 2;
- this.llRemoveOperation.TabStop = true;
- this.llRemoveOperation.Text = "Remove operation";
- this.llRemoveOperation.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llRemoveItem_LinkClicked);
- //
- // cbInfer
- //
- this.cbInfer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.cbInfer.Location = new System.Drawing.Point(336, 204);
- this.cbInfer.Name = "cbInfer";
- this.cbInfer.Size = new System.Drawing.Size(104, 16);
- this.cbInfer.TabIndex = 4;
- this.cbInfer.Text = "Infer Operations";
- this.cbInfer.CheckedChanged += new System.EventHandler(this.cbInfer_CheckedChanged);
- //
- // panel1
- //
- this.panel1.Controls.Add(this.tbEdit);
- this.panel1.Controls.Add(this.cbMEPs);
- this.panel1.Location = new System.Drawing.Point(24, 32);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(408, 192);
- this.panel1.TabIndex = 2;
- //
- // tbEdit
- //
- this.tbEdit.Location = new System.Drawing.Point(16, 16);
- this.tbEdit.Name = "tbEdit";
- this.tbEdit.Size = new System.Drawing.Size(100, 20);
- this.tbEdit.TabIndex = 3;
- this.tbEdit.Text = "textBox2";
- this.tbEdit.Visible = false;
- //
- // cbMEPs
- //
- this.cbMEPs.ItemHeight = 13;
- this.cbMEPs.Items.AddRange(new object[] {
- "Request/Response",
- "One-Way"});
- this.cbMEPs.Location = new System.Drawing.Point(272, 16);
- this.cbMEPs.Name = "cbMEPs";
- this.cbMEPs.Size = new System.Drawing.Size(121, 21);
- this.cbMEPs.TabIndex = 2;
- this.cbMEPs.Text = "comboBox1";
- this.cbMEPs.Visible = false;
- //
- // wizardPageMessageMapping
- //
- this.wizardPageMessageMapping.Controls.Add(this.ptvServiceOperations);
- this.wizardPageMessageMapping.Description = "Please enter all details for the service\'s operations and messages.";
- this.wizardPageMessageMapping.Heading = "Step 4: Specify the operation\'s message parameters";
- this.wizardPageMessageMapping.Location = new System.Drawing.Point(21, 71);
- this.wizardPageMessageMapping.Name = "wizardPageMessageMapping";
- this.wizardPageMessageMapping.Size = new System.Drawing.Size(456, 230);
- this.wizardPageMessageMapping.TabIndex = 3;
- //
- // ptvServiceOperations
- //
- this.ptvServiceOperations.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.ptvServiceOperations.ImageList = null;
- this.ptvServiceOperations.Indent = 19;
- this.ptvServiceOperations.Location = new System.Drawing.Point(0, -1);
- this.ptvServiceOperations.Name = "ptvServiceOperations";
- this.ptvServiceOperations.PaneHeaderVisible = false;
- this.ptvServiceOperations.SelectedImageIndex = -1;
- this.ptvServiceOperations.SelectedPaneNode = null;
- this.ptvServiceOperations.ShowLines = true;
- this.ptvServiceOperations.ShowPlusMinus = true;
- this.ptvServiceOperations.ShowRootLines = true;
- this.ptvServiceOperations.Size = new System.Drawing.Size(456, 232);
- this.ptvServiceOperations.SplitterColor = System.Drawing.SystemColors.AppWorkspace;
- this.ptvServiceOperations.SplitterLeft = 184;
- this.ptvServiceOperations.TabIndex = 1;
- //
- // wizardPageAdditionalOptions
- //
- this.wizardPageAdditionalOptions.Controls.Add(this.cbSoap12);
- this.wizardPageAdditionalOptions.Controls.Add(this.cbSoap11);
- this.wizardPageAdditionalOptions.Controls.Add(this.cbNeedsServiceElement);
- this.wizardPageAdditionalOptions.Controls.Add(this.cbCodeGenDialog);
- this.wizardPageAdditionalOptions.Description = "Please select any additional options to configure.";
- this.wizardPageAdditionalOptions.Heading = "Step 5: Additional options";
- this.wizardPageAdditionalOptions.Location = new System.Drawing.Point(21, 71);
- this.wizardPageAdditionalOptions.Name = "wizardPageAdditionalOptions";
- this.wizardPageAdditionalOptions.Size = new System.Drawing.Size(456, 230);
- this.wizardPageAdditionalOptions.TabIndex = 4;
- //
- // cbSoap12
- //
- this.cbSoap12.AutoSize = true;
- this.cbSoap12.Location = new System.Drawing.Point(24, 87);
- this.cbSoap12.Name = "cbSoap12";
- this.cbSoap12.Size = new System.Drawing.Size(144, 17);
- this.cbSoap12.TabIndex = 12;
- this.cbSoap12.Text = "Create SOAP 1.2 binding";
- this.cbSoap12.UseVisualStyleBackColor = true;
- //
- // cbSoap11
- //
- this.cbSoap11.AutoSize = true;
- this.cbSoap11.Checked = true;
- this.cbSoap11.CheckState = System.Windows.Forms.CheckState.Checked;
- this.cbSoap11.Enabled = false;
- this.cbSoap11.Location = new System.Drawing.Point(24, 51);
- this.cbSoap11.Name = "cbSoap11";
- this.cbSoap11.Size = new System.Drawing.Size(144, 17);
- this.cbSoap11.TabIndex = 11;
- this.cbSoap11.Text = "Create SOAP 1.1 binding";
- this.cbSoap11.UseVisualStyleBackColor = true;
- //
- // cbNeedsServiceElement
- //
- this.cbNeedsServiceElement.Location = new System.Drawing.Point(24, 8);
- this.cbNeedsServiceElement.Name = "cbNeedsServiceElement";
- this.cbNeedsServiceElement.Size = new System.Drawing.Size(192, 24);
- this.cbNeedsServiceElement.TabIndex = 10;
- this.cbNeedsServiceElement.Text = "Generate <service> element.";
- this.toolTip1.SetToolTip(this.cbNeedsServiceElement, "Enable this option if you want to have a <service> element generated for the WSDL" +
- " service description.");
- //
- // cbCodeGenDialog
- //
- this.cbCodeGenDialog.Location = new System.Drawing.Point(24, 169);
- this.cbCodeGenDialog.Name = "cbCodeGenDialog";
- this.cbCodeGenDialog.Size = new System.Drawing.Size(408, 24);
- this.cbCodeGenDialog.TabIndex = 6;
- this.cbCodeGenDialog.Text = "Open the code generation dialog after this wizard closes.";
- this.cbCodeGenDialog.CheckedChanged += new System.EventHandler(this.cbCodeGenDialog_CheckedChanged);
- //
- // wizardPageAlternativeXSDPaths
- //
- this.wizardPageAlternativeXSDPaths.Controls.Add(this.xsdpathsListView);
- this.wizardPageAlternativeXSDPaths.Description = "Please select the alternative XSD path for each XSD file imported.";
- this.wizardPageAlternativeXSDPaths.Heading = "Step 6: Alternative XSD Paths";
- this.wizardPageAlternativeXSDPaths.Location = new System.Drawing.Point(21, 71);
- this.wizardPageAlternativeXSDPaths.Name = "wizardPageAlternativeXSDPaths";
- this.wizardPageAlternativeXSDPaths.Size = new System.Drawing.Size(456, 230);
- this.wizardPageAlternativeXSDPaths.TabIndex = 5;
- //
- // xsdpathsListView
- //
- this.xsdpathsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.xsdpathsListView.DisabledColumns = ((System.Collections.ArrayList)(resources.GetObject("xsdpathsListView.DisabledColumns")));
- this.xsdpathsListView.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.xsdpathsListView.FullRowSelect = true;
- this.xsdpathsListView.GridLines = true;
- this.xsdpathsListView.Location = new System.Drawing.Point(0, 0);
- this.xsdpathsListView.Name = "xsdpathsListView";
- this.xsdpathsListView.Size = new System.Drawing.Size(456, 224);
- this.xsdpathsListView.TabIndex = 3;
- this.xsdpathsListView.UseCompatibleStateImageBehavior = false;
- this.xsdpathsListView.View = System.Windows.Forms.View.Details;
- //
- // openFileDialog1
- //
- this.openFileDialog1.Filter = "XSD Files(*.xsd)|*.xsd";
- //
- // toolTipPath
- //
- this.toolTipPath.AutomaticDelay = 1000;
- //
- // WsdlWizardForm
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(497, 360);
- this.Controls.Add(this.wsdlWizardCtrl);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
- this.HelpButton = true;
- this.Name = "WsdlWizardForm";
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "Create a WSDL Interface Description";
- this.Load += new System.EventHandler(this.WSDLWizard_Load);
- this.Closing += new System.ComponentModel.CancelEventHandler(this.WsdlWizardForm_Closing);
- this.wsdlWizardCtrl.ResumeLayout(false);
- this.wizardPageBasicMetadata.ResumeLayout(false);
- this.wizardPageBasicMetadata.PerformLayout();
- this.wizardPageSchemaImports.ResumeLayout(false);
- this.groupBox2.ResumeLayout(false);
- this.wizardPageOperationsList.ResumeLayout(false);
- this.groupBox1.ResumeLayout(false);
- this.panel1.ResumeLayout(false);
- this.panel1.PerformLayout();
- this.wizardPageMessageMapping.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.ptvServiceOperations)).EndInit();
- this.wizardPageAdditionalOptions.ResumeLayout(false);
- this.wizardPageAdditionalOptions.PerformLayout();
- this.wizardPageAlternativeXSDPaths.ResumeLayout(false);
- this.ResumeLayout(false);
-
- }
- #endregion
-
- #region Event handlers
- /// <summary>
- /// Adds an operation to the operationsListView.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">An instance of <see cref="LinkLabelLinkClickedEventArgs"/> class with Event data.</param>
- private void llAddItem_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
- {
- ListViewItem listViewItem1 =
- new ListViewItem(new string[] {
- "Operation" + operationCount,
- "Request/Response",
- "",
- ""},
- -1);
-
- operationsListView.Items.AddRange(
- new ListViewItem[] {listViewItem1});
-
- operationCount++;
- }
-
- /// <summary>
- /// Removes an operation from the operationsListView.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">An instance of <see cref="LinkLabelLinkClickedEventArgs"/> class with Event data.</param>
- /// <remarks>
- /// This method will remove the first item of the selected items collection. If no item is selected then
- /// it removes the last item available in the list.
- /// </remarks>
- private void llRemoveItem_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
- {
- if(operationsListView.Items.Count > 0)
- {
- // Remove the first item of the selected items.
- if(operationsListView.SelectedItems.Count > 0)
- {
- while (operationsListView.SelectedItems.Count != 0)
- {
- ListViewItem lvi = operationsListView.SelectedItems[0];
- operationsListView.Items.Remove(lvi);
- }
- }
- else
- {
- // If anything is not selected, remove the last item on the list.
- operationsListView.Items.RemoveAt(operationsListView.Items.Count - 1);
- operationCount--;
- }
- }
- }
-
- /// <summary>
- /// Performs the necessary initialization when the wizard control loads.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
- private void wsdlWizardCtrl_Load(object sender, EventArgs e)
- {
- // Add the columns to the operationsListView.
- operationsListView.Columns.Add("Operation Name", 210, HorizontalAlignment.Left);
- operationsListView.Columns.Add("Message Exchange Pattern", -2, HorizontalAlignment.Left);
-
- // Add the columns to the importsListView.
- importsListView.Columns.Add("File Name", 210, HorizontalAlignment.Left);
- importsListView.Columns.Add("Location", -1, HorizontalAlignment.Left);
-
- // Set the non editable columns.
- importsListView.DisabledColumns.Add("File Name");
- importsListView.DisabledColumns.Add("Location");
-
- // Add the columns to the xsdpathsListView.
- xsdpathsListView.Columns.Add("File Name", 210, HorizontalAlignment.Left);
- xsdpathsListView.Columns.Add("Alternative Path", -2, HorizontalAlignment.Left);
-
- // Set the non editable columns.
- xsdpathsListView.DisabledColumns.Add("File Name");
-
- // Load the default XSD to the schema imports list.
- string fname = schemaLocation.Substring(schemaLocation.LastIndexOf("\\") + 1);
- ListViewItem defaultLocation = new ListViewItem();
- defaultLocation.Text = fname;
- defaultLocation.SubItems.Add(schemaLocation);
- importsListView.Items.Add(defaultLocation);
-
- // Skip the wizard welcome page if the round tripping is on.
- if(RoundtripMode == true)
- {
- wsdlWizardCtrl.AdvancePage();
- tbNamespace.Enabled = false;
- }
-
- // Focus the first tbServiceName text box.
- tbServiceName.Focus();
-
- // Assign the cancel button.
- this.CancelButton = wsdlWizardCtrl.CancelButton;
- }
-
- /// <summary>
- /// Asks the confirmation question and quits the wizard upon the click of the "Cancel" button.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">An instance of <see cref="EventArgs"/> class with the event data.</param>
- private void wsdlWizardCtrl_Cancelled(object sender, EventArgs e)
- {
- /*
- if(MessageBox.Show("Do you really want to quit?",
- "WSDL Wizard", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
- {
- alreadyCancelled = true;
- this.Close();
- }
- */
- }
-
- /// <summary>
- /// Performs the actions, when the wizard's "Finish" button is clicked.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">An instance of <see cref="EventArgs"/> class with the event data.</param>
- /// <remarks>
- /// This method finally wraps up the necessary details and calls the
- /// <see cref="ServiceDescriptionEngine"/> class to generate the WSDL file.
- /// </remarks>
- private void wsdlWizardCtrl_Finished(object sender, EventArgs e)
- {
- try
- {
- // Set additional options for WSDL generation.
- serviceInterfaceContract.NeedsServiceElement =
- cbNeedsServiceElement.Checked;
-
- if (cbSoap11.Checked)
- {
- serviceInterfaceContract.Bindings |= InterfaceContract.SoapBindings.Soap11;
- }
-
- if (cbSoap12.Checked)
- {
- serviceInterfaceContract.Bindings |= InterfaceContract.SoapBindings.Soap12;
- }
-
- // Use alternative location for imports by default.
- serviceInterfaceContract.UseAlternateLocationForImports = true;
-
- // Call the GenerateWSDL method according to the round tripping mode.
- if(this.roundtripMode)
- {
- wsdlLocation = ServiceDescriptionEngine.GenerateWsdl(serviceInterfaceContract,
- wsdlLocation, GetXmlCommentForWSDL(), this.wsdlFile);
- }
- else
- {
- wsdlLocation = ServiceDescriptionEngine.GenerateWsdl(serviceInterfaceContract,
- wsdlLocation, GetXmlCommentForWSDL());
- }
-
- this.DialogResult = DialogResult.OK;
- alreadyCancelled = true;
- this.Close();
- }
- catch(WsdlGenerationException ex)
- {
- MessageBox.Show("An error occured while generating WSDL: " + ex.Message, "WSDL Wizard", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- catch(Exception generalException)
- {
- MessageBox.Show("An error occured while generating WSDL: " + generalException.Message, "WSDL Wizard", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
-
- /// <summary>
- /// Performs the actions prior to displaying each page on the wizard control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">An instance of <see cref="WizardPageDisplayedEventArgs"/> class with event data.</param>
- private void wsdlWizardCtrl_BeforePageDisplayed(object sender, WizardPageDisplayedEventArgs e)
- {
- // Assign the basic meta data values to the instance of InterfaceContract class.
- if (e.Page == wizardPageSchemaImports)
- {
- // 07-23-2005
- // BDS: Added this gate to validate the namespace uri.
- Uri uri;
- try
- {
- if (tbNamespace.Text.IndexOf(":") > -1 || Path.IsPathRooted(tbNamespace.Text))
- {
- uri = new Uri(tbNamespace.Text);
- }
- else
- {
- uri = new Uri("anyuri:" + tbNamespace.Text);
- }
- }
- catch
- {
- MessageBox.Show(this,
- "Invalid uri for the namespace. Enter a valid uri and try again.",
- "WSDL Wizard", MessageBoxButtons.OK, MessageBoxIcon.Error);
- e.Cancel = true;
- return;
- }
-
- serviceInterfaceContract.ServiceName = tbServiceName.Text;
- serviceInterfaceContract.ServiceNamespace = tbNamespace.Text;
- serviceInterfaceContract.SchemaNamespace = schemaNamespace;
- serviceInterfaceContract.ServiceDocumentation = tbServiceDoc.Text;
-
- return;
- }
-
- if (e.Page == wizardPageOperationsList)
- {
- // Clear the existing items.
- this.messageSchemas.Clear();
- this.headerSchemas.Clear();
- faultSchemas.Clear();
- this.importedSchemaNamespaces.Clear();
- this.serviceInterfaceContract.Imports.Clear();
-
- // Add the selected schemas to the ServiceInterfaceContract.Imports collection.
- foreach (ListViewItem importItem in importsListView.Items)
- {
- string schemaNamespace = string.Empty;
- string importLocation = importItem.SubItems[1].Text;
- ArrayList result;
- try
- {
- // Read the content of the imported files and add them to the local arrays for UI.
- result = ServiceDescriptionEngine.GetSchemasFromXsd(importLocation, out schemaNamespace);
- }
- catch(Exception ex)
- {
- MessageBox.Show(this, ex.Message,
- "WSDL Wizard", MessageBoxButtons.OK, MessageBoxIcon.Error);
- e.Cancel = true;
- return;
- }
-
- // Check whether the schema has a valid namespace.
- //if (schemaNamespace == null)
- //{
- // MessageBox.Show(this, "Could not import the file: " +
- // importLocation + ". The schema definition does not belong to a valid namespace.",
- // "WSDL Wizard", MessageBoxButtons.OK, MessageBoxIcon.Error);
- // wsdlWizardCtrl.JumpToPage(2);
- // return;
- //}
-
- //// Check whether the Namespace already exists in the list.
- //if (this.importedSchemaNamespaces.IndexOf(schemaNamespace.ToLower()) > -1)
- //{
- // MessageBox.Show(this, "Could not import the file: " +
- // importLocation + ". The Target Namespace already imported.",
- // "WSDL Wizard", MessageBoxButtons.OK, MessageBoxIcon.Error);
- // wsdlWizardCtrl.JumpToPage(2);
- // return;
- //}
- //else
- //{
- if(schemaNamespace != null)
- this.importedSchemaNamespaces.Add(schemaNamespace.ToLower());
- //}
-
- messageSchemas.AddRange((SchemaElements)result[1]);
- headerSchemas.AddRange((SchemaElements)result[1]);
- faultSchemas.AddRange((SchemaElements)result[1]);
-
- SchemaImport si = new SchemaImport(importItem.SubItems[1].Text, schemaNamespace, importItem.SubItems[0].Text);
-
- // Check whether the schema is in the current directory.
- if (Directory.GetFiles(this.wsdlLocation, si.SchemaName).Length > 0)
- {
- si.AlternateLocation = si.SchemaName;
- }
- else if (si.SchemaLocation.ToLower().StartsWith(this.projectRootDirectory.ToLower()))
- {
- string schemaDirectory = si.SchemaLocation.Substring(
- 0, si.SchemaLocation.LastIndexOf('\\'));
- string currentDirectory = wsdlLocation;
- // Remove the project root before passing them to the relative path finder.
- schemaDirectory = schemaDirectory.Substring(this.projectRootDirectory.Length);
- currentDirectory = currentDirectory.Substring(this.projectRootDirectory.Length);
-
- si.AlternateLocation = IOPathHelper.GetRelativePath(schemaDirectory, currentDirectory);
- if (si.AlternateLocation.EndsWith("/"))
- {
- si.AlternateLocation = si.AlternateLocation + si.SchemaName;
- }
- else
- {
- si.AlternateLocation = si.AlternateLocation + "/" + si.SchemaName;
- }
- }
- else
- {
- si.AlternateLocation = si.SchemaLocation;
- }
- serviceInterfaceContract.Imports.Add(si);
- }
-
- // Import the embedded types.
- ImportEmbeddedTypes();
-
- // Check for the messages count found in the imported files and alert the user if no messages
- // are found.
- if (messageSchemas.Count < 1)
- {
- MessageBox.Show("There are no elements in this XSD to use as operation messages.",
- "WSDL Wizard", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- e.Cancel = true;
- return;
- }
-
- return;
- }
-
- if (e.Page == wizardPageMessageMapping)
- {
- try
- {
- // Setup the dynamic UI controls for the operation - message mapping UI.
- SetupOperationsMessagesPanes();
-
- if (ptvServiceOperations.PaneNodes.Count > 0)
- {
- ptvServiceOperations.SelectedPaneNode = ptvServiceOperations.PaneNodes[0];
- ptvServiceOperations.PaneNodes[0].Expanded = true;
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- return;
- }
-
- if (e.Page == wizardPageAdditionalOptions)
- {
- cbCodeGenDialog.Checked = this.roundtripMode;
- return;
- }
-
- if (e.Page == wizardPageAlternativeXSDPaths)
- {
- xsdpathsListView.Items.Clear();
- if (serviceInterfaceContract.Imports.Count > 0)
- {
- foreach (SchemaImport import in serviceInterfaceContract.Imports)
- {
- ListViewItem li = new ListViewItem(import.SchemaName);
- li.SubItems.Add(import.AlternateLocation);
- xsdpathsListView.Items.Add(li);
- }
- }
- else
- {
- wsdlWizardCtrl.AdvancePage();
- }
- return;
- }
- }
-
- /// <summary>
- /// Handles the SelectedIndexChanged event of the dynami…
Large files files are truncated, but you can click here to view the full file