PageRenderTime 69ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 1ms

/WSCF.Blue/source/UI/WsdlWizard/WsdlWizardForm.cs

#
C# | 3304 lines | 2352 code | 350 blank | 602 comment | 171 complexity | 0eced8fd8c69baa9b16743bf11f5b9b3 MD5 | raw file
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Specialized;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Drawing;
  7. using System.Globalization;
  8. using System.Linq;
  9. using System.Windows.Forms;
  10. using System.IO;
  11. using System.Text;
  12. using System.Reflection;
  13. using System.Net;
  14. using Thinktecture.Tools.Web.Services;
  15. using Thinktecture.Tools.Wscf.Services.ServiceDescription;
  16. using Thinktecture.Tools.Wscf.Services.ServiceDescription.Exceptions;
  17. using WizardControl;
  18. using WRM.Windows.Forms;
  19. using Message = Thinktecture.Tools.Wscf.Services.ServiceDescription.Message;
  20. using Thinktecture.Tools.Web.Services.Wscf.Environment;
  21. namespace Thinktecture.Tools.Wscf.UI.WsdlWizard
  22. {
  23. /// <summary>
  24. /// Represents the user interface handler for WsdlWizardForm.
  25. /// </summary>
  26. public class WsdlWizardForm : Form
  27. {
  28. #region Private fields
  29. #region "Primitives"
  30. private int operationCount;
  31. private string schemaLocation = "";
  32. private string wsdlLocation = "";
  33. private string schemaNamespace = "";
  34. private bool openCodeGenDialog;
  35. private bool alreadyCancelled = false;
  36. private bool roundtripMode = false;
  37. private string currentFolder;
  38. private string wsdlFile = string.Empty;
  39. private string defaultPathForImports = string.Empty;
  40. private string projectRootDirectory = string.Empty;
  41. #endregion
  42. #region "Objects"
  43. private ArrayList importedSchemaNamespaces = new ArrayList();
  44. private InterfaceContract serviceInterfaceContract;
  45. private InterfaceContract importedContract = null;
  46. //private SchemaElements messageSchemas = new SchemaElements();
  47. //private SchemaElements headerSchemas = new SchemaElements();
  48. //private OperationsCollection inferOperations = new OperationsCollection(10);
  49. private List<Operation> oldOperations =
  50. new List<Operation>(); // Holds a list of old operations configured by the user.
  51. #endregion
  52. #region "WizardPages and Items"
  53. private Wizard wsdlWizardCtrl;
  54. private WizardPage wizardPageBasicMetadata;
  55. private TextBox tbServiceName;
  56. private Label lblServiceName;
  57. private Label lblNamespace;
  58. private WizardPage wizardPageOperationsList;
  59. private GroupBox groupBox1;
  60. private TextBox tbEdit;
  61. private ComboBox cbMEPs;
  62. private Panel panel1;
  63. private ToolTip toolTip1;
  64. private IContainer components;
  65. private TextBox tbNamespace;
  66. private LinkLabel llAddOperation;
  67. private EditableListView operationsListView;
  68. private LinkLabel llRemoveOperation;
  69. private Label lblServiceDoc;
  70. private TextBox tbServiceDoc;
  71. private WizardPage wizardPageMessageMapping;
  72. private WizardControl.WizardPage wizardPageAdditionalOptions;
  73. private System.Windows.Forms.CheckBox cbNeedsServiceElement;
  74. private System.Windows.Forms.CheckBox cbCodeGenDialog;
  75. private WRM.Windows.Forms.PropertyTree ptvServiceOperations;
  76. private WizardControl.WizardPage wizardPageSchemaImports;
  77. private System.Windows.Forms.GroupBox groupBox2;
  78. private Thinktecture.Tools.Wscf.UI.WsdlWizard.EditableListView importsListView;
  79. private System.Windows.Forms.LinkLabel llAddImport;
  80. private System.Windows.Forms.LinkLabel llRemoveImport;
  81. private System.Windows.Forms.OpenFileDialog openFileDialog1;
  82. private WizardControl.WizardPage wizardPageAlternativeXSDPaths;
  83. private Thinktecture.Tools.Wscf.UI.WsdlWizard.EditableListView xsdpathsListView;
  84. private System.Windows.Forms.ToolTip toolTipPath;
  85. private System.Windows.Forms.CheckBox cbInfer;
  86. private CheckBox cbSoap12;
  87. private CheckBox cbSoap11;
  88. #endregion
  89. #endregion
  90. #region Public properties.
  91. /// <summary>
  92. /// Gets a value indicating whether the code generation dialog should be opened or not.
  93. /// </summary>
  94. public bool OpenCodeGenDialog
  95. {
  96. get { return openCodeGenDialog; }
  97. }
  98. /// <summary>
  99. /// Gets or sets the location to create the WSDL file.
  100. /// </summary>
  101. public string WsdlLocation
  102. {
  103. get { return wsdlLocation; }
  104. set { wsdlLocation = value; }
  105. }
  106. /// <summary>
  107. /// Gets or sets the schema namespace.
  108. /// </summary>
  109. public string SchemaNamespace
  110. {
  111. get { return schemaNamespace; }
  112. set { schemaNamespace = value; }
  113. }
  114. /// <summary>
  115. /// Gets or sets the schema location.
  116. /// </summary>
  117. public string SchemaLocation
  118. {
  119. get { return schemaLocation; }
  120. set
  121. {
  122. schemaLocation = value;
  123. this.UpdateCurrentFolder(schemaLocation);
  124. }
  125. }
  126. /// <summary>
  127. /// Gets or sets a value indicating whether the round tripping mode is on or off.
  128. /// </summary>
  129. public bool RoundtripMode
  130. {
  131. get { return roundtripMode; }
  132. set { roundtripMode = value; }
  133. }
  134. /// <summary>
  135. /// Gets or sets the default path for the imported XSD files.
  136. /// </summary>
  137. public string DefaultPathForImports
  138. {
  139. get { return defaultPathForImports; }
  140. set { defaultPathForImports = value; }
  141. }
  142. /// <summary>
  143. /// Gets or sets the root directory for the project.
  144. /// </summary>
  145. public string ProjectRootDirectory
  146. {
  147. get { return projectRootDirectory; }
  148. set { projectRootDirectory = value; }
  149. }
  150. #endregion
  151. #region Constructors
  152. /// <summary>
  153. /// Initializes a new instance of WsdlWizardForm class with the specified values.
  154. /// </summary>
  155. /// <param name="xsdLocation">
  156. /// Location of the XSD file containing the message contract definitions for the WSDL.
  157. /// </param>
  158. public WsdlWizardForm(string xsdLocation)
  159. {
  160. //
  161. // Required for Windows Form Designer support.
  162. //
  163. InitializeComponent();
  164. schemaLocation = xsdLocation;
  165. this.UpdateCurrentFolder(schemaLocation);
  166. serviceInterfaceContract = new InterfaceContract();
  167. serviceInterfaceContract.SchemaNamespace = schemaLocation;
  168. }
  169. /// <summary>
  170. /// Initializes a new instance of WsdlWizardForm class with the specified values.
  171. /// </summary>
  172. /// <param name="wsdlLocation">Location of the WSDL file to modify.</param>
  173. /// <param name="roundTripping">
  174. /// Value indicating that the round tripping is required.
  175. /// </param>
  176. /// <remarks>
  177. /// The roundTripping parameter must be set to true in order to use the round tripping feature.
  178. /// </remarks>
  179. public WsdlWizardForm(string wsdlLocation, bool roundTripping)
  180. {
  181. //
  182. // Required for Windows Form Designer support.
  183. //
  184. InitializeComponent();
  185. // Import the interface contract from the selected WSDL file.
  186. try
  187. {
  188. this.importedContract =
  189. ServiceDescriptionEngine.GetInterfaceContract(wsdlLocation);
  190. this.wsdlFile = wsdlLocation;
  191. }
  192. catch(WsdlModifiedException ex)
  193. {
  194. throw new WsdlFileLoadException(
  195. "Could not import the specified WSDL file for round-triping.\nThis file is not compatible for round-tripping.", ex);
  196. }
  197. catch(WsdlNotCompatibleForRoundTrippingException ex)
  198. {
  199. throw new WsdlFileLoadException(
  200. "Could not import the specified WSDL file for round-triping.\nThis file is not compatible for round-tripping.", ex);
  201. }
  202. catch
  203. {
  204. throw new WsdlFileLoadException(
  205. "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.");
  206. }
  207. this.UpdateCurrentFolder(wsdlLocation);
  208. serviceInterfaceContract = new InterfaceContract();
  209. serviceInterfaceContract.SchemaNamespace = schemaLocation;
  210. this.roundtripMode = roundTripping;
  211. }
  212. #endregion
  213. #region Dispose
  214. /// <summary>
  215. /// Clean up any resources being used.
  216. /// </summary>
  217. protected override void Dispose( bool disposing )
  218. {
  219. if( disposing )
  220. {
  221. if(components != null)
  222. {
  223. components.Dispose();
  224. }
  225. }
  226. base.Dispose( disposing );
  227. }
  228. #endregion
  229. #region Windows Form Designer generated code
  230. /// <summary>
  231. /// Required method for Designer support - do not modify
  232. /// the contents of this method with the code editor.
  233. /// </summary>
  234. private void InitializeComponent()
  235. {
  236. this.components = new System.ComponentModel.Container();
  237. System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WsdlWizardForm));
  238. this.wsdlWizardCtrl = new WizardControl.Wizard();
  239. this.wizardPageBasicMetadata = new WizardControl.WizardPage();
  240. this.tbServiceDoc = new System.Windows.Forms.TextBox();
  241. this.lblServiceDoc = new System.Windows.Forms.Label();
  242. this.lblNamespace = new System.Windows.Forms.Label();
  243. this.tbNamespace = new System.Windows.Forms.TextBox();
  244. this.lblServiceName = new System.Windows.Forms.Label();
  245. this.tbServiceName = new System.Windows.Forms.TextBox();
  246. this.wizardPageSchemaImports = new WizardControl.WizardPage();
  247. this.groupBox2 = new System.Windows.Forms.GroupBox();
  248. this.llRemoveImport = new System.Windows.Forms.LinkLabel();
  249. this.llAddImport = new System.Windows.Forms.LinkLabel();
  250. this.importsListView = new Thinktecture.Tools.Wscf.UI.WsdlWizard.EditableListView();
  251. this.wizardPageOperationsList = new WizardControl.WizardPage();
  252. this.groupBox1 = new System.Windows.Forms.GroupBox();
  253. this.operationsListView = new Thinktecture.Tools.Wscf.UI.WsdlWizard.EditableListView();
  254. this.llAddOperation = new System.Windows.Forms.LinkLabel();
  255. this.llRemoveOperation = new System.Windows.Forms.LinkLabel();
  256. this.cbInfer = new System.Windows.Forms.CheckBox();
  257. this.panel1 = new System.Windows.Forms.Panel();
  258. this.tbEdit = new System.Windows.Forms.TextBox();
  259. this.cbMEPs = new System.Windows.Forms.ComboBox();
  260. this.wizardPageMessageMapping = new WizardControl.WizardPage();
  261. this.ptvServiceOperations = new WRM.Windows.Forms.PropertyTree();
  262. this.wizardPageAdditionalOptions = new WizardControl.WizardPage();
  263. this.cbSoap12 = new System.Windows.Forms.CheckBox();
  264. this.cbSoap11 = new System.Windows.Forms.CheckBox();
  265. this.cbNeedsServiceElement = new System.Windows.Forms.CheckBox();
  266. this.cbCodeGenDialog = new System.Windows.Forms.CheckBox();
  267. this.wizardPageAlternativeXSDPaths = new WizardControl.WizardPage();
  268. this.xsdpathsListView = new Thinktecture.Tools.Wscf.UI.WsdlWizard.EditableListView();
  269. this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
  270. this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
  271. this.toolTipPath = new System.Windows.Forms.ToolTip(this.components);
  272. this.wsdlWizardCtrl.SuspendLayout();
  273. this.wizardPageBasicMetadata.SuspendLayout();
  274. this.wizardPageSchemaImports.SuspendLayout();
  275. this.groupBox2.SuspendLayout();
  276. this.wizardPageOperationsList.SuspendLayout();
  277. this.groupBox1.SuspendLayout();
  278. this.panel1.SuspendLayout();
  279. this.wizardPageMessageMapping.SuspendLayout();
  280. ((System.ComponentModel.ISupportInitialize)(this.ptvServiceOperations)).BeginInit();
  281. this.wizardPageAdditionalOptions.SuspendLayout();
  282. this.wizardPageAlternativeXSDPaths.SuspendLayout();
  283. this.SuspendLayout();
  284. //
  285. // wsdlWizardCtrl
  286. //
  287. this.wsdlWizardCtrl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  288. | System.Windows.Forms.AnchorStyles.Left)
  289. | System.Windows.Forms.AnchorStyles.Right)));
  290. this.wsdlWizardCtrl.BannerBitmap = ((System.Drawing.Image)(resources.GetObject("wsdlWizardCtrl.BannerBitmap")));
  291. this.wsdlWizardCtrl.CloseForm = false;
  292. this.wsdlWizardCtrl.Controls.Add(this.wizardPageBasicMetadata);
  293. this.wsdlWizardCtrl.Controls.Add(this.wizardPageSchemaImports);
  294. this.wsdlWizardCtrl.Controls.Add(this.wizardPageOperationsList);
  295. this.wsdlWizardCtrl.Controls.Add(this.wizardPageMessageMapping);
  296. this.wsdlWizardCtrl.Controls.Add(this.wizardPageAdditionalOptions);
  297. this.wsdlWizardCtrl.Controls.Add(this.wizardPageAlternativeXSDPaths);
  298. this.wsdlWizardCtrl.Location = new System.Drawing.Point(0, 0);
  299. this.wsdlWizardCtrl.Name = "wsdlWizardCtrl";
  300. this.wsdlWizardCtrl.Size = new System.Drawing.Size(497, 360);
  301. this.wsdlWizardCtrl.TabIndex = 0;
  302. this.wsdlWizardCtrl.Title = "Generate WSDL";
  303. this.wsdlWizardCtrl.WelcomeBitmap = ((System.Drawing.Image)(resources.GetObject("wsdlWizardCtrl.WelcomeBitmap")));
  304. this.wsdlWizardCtrl.WelcomeText = resources.GetString("wsdlWizardCtrl.WelcomeText");
  305. this.wsdlWizardCtrl.BeforeSummaryPageDisplayed += new WizardControl.Wizard.BeforeSummaryPageDisplayedEventHandler(this.wsdlWizardCtrl_BeforeSummaryPageDisplayed);
  306. this.wsdlWizardCtrl.Finished += new WizardControl.Wizard.FinishedEventHandler(this.wsdlWizardCtrl_Finished);
  307. this.wsdlWizardCtrl.Load += new System.EventHandler(this.wsdlWizardCtrl_Load);
  308. this.wsdlWizardCtrl.Cancelled += new WizardControl.Wizard.CancelledEventHandler(this.wsdlWizardCtrl_Cancelled);
  309. this.wsdlWizardCtrl.BeforePageDisplayed += new WizardControl.Wizard.BeforePageDisplayedEventHandler(this.wsdlWizardCtrl_BeforePageDisplayed);
  310. this.wsdlWizardCtrl.AfterPageDisplayed += new WizardControl.Wizard.AfterPageDisplayedEventHandler(this.wsdlWizardCtrl_AfterPageDisplayed);
  311. this.wsdlWizardCtrl.ValidatePage += new WizardControl.Wizard.ValidatePageEventHandler(this.wsdlWizardCtrl_ValidatePage);
  312. //
  313. // wizardPageBasicMetadata
  314. //
  315. this.wizardPageBasicMetadata.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  316. | System.Windows.Forms.AnchorStyles.Left)
  317. | System.Windows.Forms.AnchorStyles.Right)));
  318. this.wizardPageBasicMetadata.Controls.Add(this.tbServiceDoc);
  319. this.wizardPageBasicMetadata.Controls.Add(this.lblServiceDoc);
  320. this.wizardPageBasicMetadata.Controls.Add(this.lblNamespace);
  321. this.wizardPageBasicMetadata.Controls.Add(this.tbNamespace);
  322. this.wizardPageBasicMetadata.Controls.Add(this.lblServiceName);
  323. this.wizardPageBasicMetadata.Controls.Add(this.tbServiceName);
  324. this.wizardPageBasicMetadata.Description = "Please enter the name and the XML namespace of the Web Service.";
  325. this.wizardPageBasicMetadata.Heading = "Step 1: Specify your Web Service\'s basic settings";
  326. this.wizardPageBasicMetadata.Location = new System.Drawing.Point(21, 71);
  327. this.wizardPageBasicMetadata.Name = "wizardPageBasicMetadata";
  328. this.wizardPageBasicMetadata.Size = new System.Drawing.Size(456, 230);
  329. this.wizardPageBasicMetadata.TabIndex = 0;
  330. //
  331. // tbServiceDoc
  332. //
  333. this.tbServiceDoc.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  334. | System.Windows.Forms.AnchorStyles.Left)
  335. | System.Windows.Forms.AnchorStyles.Right)));
  336. this.tbServiceDoc.Location = new System.Drawing.Point(120, 72);
  337. this.tbServiceDoc.Multiline = true;
  338. this.tbServiceDoc.Name = "tbServiceDoc";
  339. this.tbServiceDoc.Size = new System.Drawing.Size(312, 88);
  340. this.tbServiceDoc.TabIndex = 5;
  341. //
  342. // lblServiceDoc
  343. //
  344. this.lblServiceDoc.Location = new System.Drawing.Point(24, 72);
  345. this.lblServiceDoc.Name = "lblServiceDoc";
  346. this.lblServiceDoc.Size = new System.Drawing.Size(100, 23);
  347. this.lblServiceDoc.TabIndex = 4;
  348. this.lblServiceDoc.Text = "Documentation:";
  349. //
  350. // lblNamespace
  351. //
  352. this.lblNamespace.Location = new System.Drawing.Point(24, 40);
  353. this.lblNamespace.Name = "lblNamespace";
  354. this.lblNamespace.Size = new System.Drawing.Size(96, 23);
  355. this.lblNamespace.TabIndex = 3;
  356. this.lblNamespace.Text = "XML namespace:";
  357. //
  358. // tbNamespace
  359. //
  360. this.tbNamespace.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  361. | System.Windows.Forms.AnchorStyles.Right)));
  362. this.tbNamespace.Location = new System.Drawing.Point(120, 40);
  363. this.tbNamespace.Name = "tbNamespace";
  364. this.tbNamespace.Size = new System.Drawing.Size(312, 20);
  365. this.tbNamespace.TabIndex = 2;
  366. //
  367. // lblServiceName
  368. //
  369. this.lblServiceName.Location = new System.Drawing.Point(24, 8);
  370. this.lblServiceName.Name = "lblServiceName";
  371. this.lblServiceName.Size = new System.Drawing.Size(88, 23);
  372. this.lblServiceName.TabIndex = 1;
  373. this.lblServiceName.Text = "Service name:";
  374. this.toolTip1.SetToolTip(this.lblServiceName, "\'Service name\' specifies the name of the Web Service binding to be generated. Thi" +
  375. "s will be the e.g. the class name for your Web Service proxy when generated from" +
  376. " the service description.");
  377. //
  378. // tbServiceName
  379. //
  380. this.tbServiceName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  381. | System.Windows.Forms.AnchorStyles.Right)));
  382. this.tbServiceName.Location = new System.Drawing.Point(120, 6);
  383. this.tbServiceName.Name = "tbServiceName";
  384. this.tbServiceName.Size = new System.Drawing.Size(312, 20);
  385. this.tbServiceName.TabIndex = 0;
  386. this.toolTip1.SetToolTip(this.tbServiceName, "\'Service name\' specifies the name of the Web Service binding to be generated. Thi" +
  387. "s will be the e.g. the class name for your Web Service proxy when generated from" +
  388. " the service description.");
  389. //
  390. // wizardPageSchemaImports
  391. //
  392. this.wizardPageSchemaImports.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  393. | System.Windows.Forms.AnchorStyles.Left)
  394. | System.Windows.Forms.AnchorStyles.Right)));
  395. this.wizardPageSchemaImports.Controls.Add(this.groupBox2);
  396. this.wizardPageSchemaImports.Cursor = System.Windows.Forms.Cursors.Default;
  397. this.wizardPageSchemaImports.Description = "Please add additional message schemas from XSD files as appropriate.";
  398. this.wizardPageSchemaImports.Heading = "Step 2: Specify additional message schemas";
  399. this.wizardPageSchemaImports.Location = new System.Drawing.Point(21, 71);
  400. this.wizardPageSchemaImports.Name = "wizardPageSchemaImports";
  401. this.wizardPageSchemaImports.Size = new System.Drawing.Size(456, 230);
  402. this.wizardPageSchemaImports.TabIndex = 2;
  403. //
  404. // groupBox2
  405. //
  406. this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  407. | System.Windows.Forms.AnchorStyles.Left)
  408. | System.Windows.Forms.AnchorStyles.Right)));
  409. this.groupBox2.Controls.Add(this.llRemoveImport);
  410. this.groupBox2.Controls.Add(this.llAddImport);
  411. this.groupBox2.Controls.Add(this.importsListView);
  412. this.groupBox2.Location = new System.Drawing.Point(8, 3);
  413. this.groupBox2.Name = "groupBox2";
  414. this.groupBox2.Size = new System.Drawing.Size(440, 224);
  415. this.groupBox2.TabIndex = 2;
  416. this.groupBox2.TabStop = false;
  417. this.groupBox2.Text = "XSD Imports:";
  418. //
  419. // llRemoveImport
  420. //
  421. this.llRemoveImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  422. this.llRemoveImport.Location = new System.Drawing.Point(95, 205);
  423. this.llRemoveImport.Name = "llRemoveImport";
  424. this.llRemoveImport.Size = new System.Drawing.Size(100, 16);
  425. this.llRemoveImport.TabIndex = 4;
  426. this.llRemoveImport.TabStop = true;
  427. this.llRemoveImport.Text = "Remove import";
  428. this.llRemoveImport.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llRemoveImport_LinkClicked);
  429. //
  430. // llAddImport
  431. //
  432. this.llAddImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  433. this.llAddImport.Location = new System.Drawing.Point(8, 205);
  434. this.llAddImport.Name = "llAddImport";
  435. this.llAddImport.Size = new System.Drawing.Size(81, 15);
  436. this.llAddImport.TabIndex = 3;
  437. this.llAddImport.TabStop = true;
  438. this.llAddImport.Text = "Add import";
  439. this.llAddImport.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llAddImport_LinkClicked);
  440. //
  441. // importsListView
  442. //
  443. this.importsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  444. | System.Windows.Forms.AnchorStyles.Left)
  445. | System.Windows.Forms.AnchorStyles.Right)));
  446. this.importsListView.DisabledColumns = ((System.Collections.ArrayList)(resources.GetObject("importsListView.DisabledColumns")));
  447. this.importsListView.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  448. this.importsListView.FullRowSelect = true;
  449. this.importsListView.GridLines = true;
  450. this.importsListView.Location = new System.Drawing.Point(8, 16);
  451. this.importsListView.Name = "importsListView";
  452. this.importsListView.Size = new System.Drawing.Size(424, 184);
  453. this.importsListView.TabIndex = 2;
  454. this.importsListView.UseCompatibleStateImageBehavior = false;
  455. this.importsListView.View = System.Windows.Forms.View.Details;
  456. this.importsListView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.importsListView_MouseMove);
  457. //
  458. // wizardPageOperationsList
  459. //
  460. this.wizardPageOperationsList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  461. | System.Windows.Forms.AnchorStyles.Left)
  462. | System.Windows.Forms.AnchorStyles.Right)));
  463. this.wizardPageOperationsList.Controls.Add(this.groupBox1);
  464. this.wizardPageOperationsList.Controls.Add(this.panel1);
  465. this.wizardPageOperationsList.Description = "Please add operations to the Web Service as needed.";
  466. this.wizardPageOperationsList.Heading = "Step 3: Specify settings for your Web Service\'s operations.";
  467. this.wizardPageOperationsList.Location = new System.Drawing.Point(21, 71);
  468. this.wizardPageOperationsList.Name = "wizardPageOperationsList";
  469. this.wizardPageOperationsList.Size = new System.Drawing.Size(456, 230);
  470. this.wizardPageOperationsList.TabIndex = 1;
  471. //
  472. // groupBox1
  473. //
  474. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  475. | System.Windows.Forms.AnchorStyles.Left)
  476. | System.Windows.Forms.AnchorStyles.Right)));
  477. this.groupBox1.Controls.Add(this.operationsListView);
  478. this.groupBox1.Controls.Add(this.llAddOperation);
  479. this.groupBox1.Controls.Add(this.llRemoveOperation);
  480. this.groupBox1.Controls.Add(this.cbInfer);
  481. this.groupBox1.Location = new System.Drawing.Point(8, 3);
  482. this.groupBox1.Name = "groupBox1";
  483. this.groupBox1.Size = new System.Drawing.Size(440, 224);
  484. this.groupBox1.TabIndex = 4;
  485. this.groupBox1.TabStop = false;
  486. this.groupBox1.Text = "Operations:";
  487. //
  488. // operationsListView
  489. //
  490. this.operationsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  491. | System.Windows.Forms.AnchorStyles.Left)
  492. | System.Windows.Forms.AnchorStyles.Right)));
  493. this.operationsListView.DisabledColumns = ((System.Collections.ArrayList)(resources.GetObject("operationsListView.DisabledColumns")));
  494. this.operationsListView.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  495. this.operationsListView.FullRowSelect = true;
  496. this.operationsListView.GridLines = true;
  497. this.operationsListView.Location = new System.Drawing.Point(8, 16);
  498. this.operationsListView.Name = "operationsListView";
  499. this.operationsListView.Size = new System.Drawing.Size(424, 184);
  500. this.operationsListView.TabIndex = 0;
  501. this.operationsListView.UseCompatibleStateImageBehavior = false;
  502. this.operationsListView.View = System.Windows.Forms.View.Details;
  503. //
  504. // llAddOperation
  505. //
  506. this.llAddOperation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  507. this.llAddOperation.Location = new System.Drawing.Point(7, 205);
  508. this.llAddOperation.Name = "llAddOperation";
  509. this.llAddOperation.Size = new System.Drawing.Size(81, 15);
  510. this.llAddOperation.TabIndex = 1;
  511. this.llAddOperation.TabStop = true;
  512. this.llAddOperation.Text = "Add operation";
  513. this.llAddOperation.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llAddOperation_LinkClicked);
  514. //
  515. // llRemoveOperation
  516. //
  517. this.llRemoveOperation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  518. this.llRemoveOperation.Location = new System.Drawing.Point(95, 205);
  519. this.llRemoveOperation.Name = "llRemoveOperation";
  520. this.llRemoveOperation.Size = new System.Drawing.Size(100, 16);
  521. this.llRemoveOperation.TabIndex = 2;
  522. this.llRemoveOperation.TabStop = true;
  523. this.llRemoveOperation.Text = "Remove operation";
  524. this.llRemoveOperation.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llRemoveOperation_LinkClicked);
  525. //
  526. // cbInfer
  527. //
  528. this.cbInfer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  529. this.cbInfer.Location = new System.Drawing.Point(336, 204);
  530. this.cbInfer.Name = "cbInfer";
  531. this.cbInfer.Size = new System.Drawing.Size(104, 16);
  532. this.cbInfer.TabIndex = 4;
  533. this.cbInfer.Text = "Infer Operations";
  534. this.cbInfer.CheckedChanged += new System.EventHandler(this.cbInfer_CheckedChanged);
  535. //
  536. // panel1
  537. //
  538. this.panel1.Controls.Add(this.tbEdit);
  539. this.panel1.Controls.Add(this.cbMEPs);
  540. this.panel1.Location = new System.Drawing.Point(24, 32);
  541. this.panel1.Name = "panel1";
  542. this.panel1.Size = new System.Drawing.Size(408, 192);
  543. this.panel1.TabIndex = 2;
  544. //
  545. // tbEdit
  546. //
  547. this.tbEdit.Location = new System.Drawing.Point(16, 16);
  548. this.tbEdit.Name = "tbEdit";
  549. this.tbEdit.Size = new System.Drawing.Size(100, 20);
  550. this.tbEdit.TabIndex = 3;
  551. this.tbEdit.Text = "textBox2";
  552. this.tbEdit.Visible = false;
  553. //
  554. // cbMEPs
  555. //
  556. this.cbMEPs.ItemHeight = 13;
  557. this.cbMEPs.Items.AddRange(new object[] {
  558. "Request/Response",
  559. "One-Way"});
  560. this.cbMEPs.Location = new System.Drawing.Point(272, 16);
  561. this.cbMEPs.Name = "cbMEPs";
  562. this.cbMEPs.Size = new System.Drawing.Size(121, 21);
  563. this.cbMEPs.TabIndex = 2;
  564. this.cbMEPs.Text = "comboBox1";
  565. this.cbMEPs.Visible = false;
  566. //
  567. // wizardPageMessageMapping
  568. //
  569. this.wizardPageMessageMapping.Controls.Add(this.ptvServiceOperations);
  570. this.wizardPageMessageMapping.Description = "Please enter all details for the service\'s operations and messages.";
  571. this.wizardPageMessageMapping.Heading = "Step 4: Specify the operation\'s message parameters";
  572. this.wizardPageMessageMapping.Location = new System.Drawing.Point(21, 71);
  573. this.wizardPageMessageMapping.Name = "wizardPageMessageMapping";
  574. this.wizardPageMessageMapping.Size = new System.Drawing.Size(456, 230);
  575. this.wizardPageMessageMapping.TabIndex = 3;
  576. //
  577. // ptvServiceOperations
  578. //
  579. this.ptvServiceOperations.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  580. | System.Windows.Forms.AnchorStyles.Left)
  581. | System.Windows.Forms.AnchorStyles.Right)));
  582. this.ptvServiceOperations.ImageList = null;
  583. this.ptvServiceOperations.Indent = 19;
  584. this.ptvServiceOperations.Location = new System.Drawing.Point(0, -1);
  585. this.ptvServiceOperations.Name = "ptvServiceOperations";
  586. this.ptvServiceOperations.PaneHeaderVisible = false;
  587. this.ptvServiceOperations.SelectedImageIndex = -1;
  588. this.ptvServiceOperations.SelectedPaneNode = null;
  589. this.ptvServiceOperations.ShowLines = true;
  590. this.ptvServiceOperations.ShowPlusMinus = true;
  591. this.ptvServiceOperations.ShowRootLines = true;
  592. this.ptvServiceOperations.Size = new System.Drawing.Size(456, 232);
  593. this.ptvServiceOperations.SplitterColor = System.Drawing.SystemColors.AppWorkspace;
  594. this.ptvServiceOperations.SplitterLeft = 184;
  595. this.ptvServiceOperations.TabIndex = 1;
  596. //
  597. // wizardPageAdditionalOptions
  598. //
  599. this.wizardPageAdditionalOptions.Controls.Add(this.cbSoap12);
  600. this.wizardPageAdditionalOptions.Controls.Add(this.cbSoap11);
  601. this.wizardPageAdditionalOptions.Controls.Add(this.cbNeedsServiceElement);
  602. this.wizardPageAdditionalOptions.Controls.Add(this.cbCodeGenDialog);
  603. this.wizardPageAdditionalOptions.Description = "Please select any additional options to configure.";
  604. this.wizardPageAdditionalOptions.Heading = "Step 5: Additional options";
  605. this.wizardPageAdditionalOptions.Location = new System.Drawing.Point(21, 71);
  606. this.wizardPageAdditionalOptions.Name = "wizardPageAdditionalOptions";
  607. this.wizardPageAdditionalOptions.Size = new System.Drawing.Size(456, 230);
  608. this.wizardPageAdditionalOptions.TabIndex = 4;
  609. //
  610. // cbSoap12
  611. //
  612. this.cbSoap12.AutoSize = true;
  613. this.cbSoap12.Location = new System.Drawing.Point(24, 87);
  614. this.cbSoap12.Name = "cbSoap12";
  615. this.cbSoap12.Size = new System.Drawing.Size(144, 17);
  616. this.cbSoap12.TabIndex = 12;
  617. this.cbSoap12.Text = "Create SOAP 1.2 binding";
  618. this.cbSoap12.UseVisualStyleBackColor = true;
  619. //
  620. // cbSoap11
  621. //
  622. this.cbSoap11.AutoSize = true;
  623. this.cbSoap11.Checked = true;
  624. this.cbSoap11.CheckState = System.Windows.Forms.CheckState.Checked;
  625. this.cbSoap11.Enabled = false;
  626. this.cbSoap11.Location = new System.Drawing.Point(24, 51);
  627. this.cbSoap11.Name = "cbSoap11";
  628. this.cbSoap11.Size = new System.Drawing.Size(144, 17);
  629. this.cbSoap11.TabIndex = 11;
  630. this.cbSoap11.Text = "Create SOAP 1.1 binding";
  631. this.cbSoap11.UseVisualStyleBackColor = true;
  632. //
  633. // cbNeedsServiceElement
  634. //
  635. this.cbNeedsServiceElement.Location = new System.Drawing.Point(24, 8);
  636. this.cbNeedsServiceElement.Name = "cbNeedsServiceElement";
  637. this.cbNeedsServiceElement.Size = new System.Drawing.Size(192, 24);
  638. this.cbNeedsServiceElement.TabIndex = 10;
  639. this.cbNeedsServiceElement.Text = "Generate <service> element.";
  640. this.toolTip1.SetToolTip(this.cbNeedsServiceElement, "Enable this option if you want to have a <service> element generated for the WSDL" +
  641. " service description.");
  642. //
  643. // cbCodeGenDialog
  644. //
  645. this.cbCodeGenDialog.Location = new System.Drawing.Point(24, 169);
  646. this.cbCodeGenDialog.Name = "cbCodeGenDialog";
  647. this.cbCodeGenDialog.Size = new System.Drawing.Size(408, 24);
  648. this.cbCodeGenDialog.TabIndex = 6;
  649. this.cbCodeGenDialog.Text = "Open the code generation dialog after this wizard closes.";
  650. this.cbCodeGenDialog.CheckedChanged += new System.EventHandler(this.cbCodeGenDialog_CheckedChanged);
  651. //
  652. // wizardPageAlternativeXSDPaths
  653. //
  654. this.wizardPageAlternativeXSDPaths.Controls.Add(this.xsdpathsListView);
  655. this.wizardPageAlternativeXSDPaths.Description = "Please select the alternative XSD path for each XSD file imported.";
  656. this.wizardPageAlternativeXSDPaths.Heading = "Step 6: Alternative XSD Paths";
  657. this.wizardPageAlternativeXSDPaths.Location = new System.Drawing.Point(21, 71);
  658. this.wizardPageAlternativeXSDPaths.Name = "wizardPageAlternativeXSDPaths";
  659. this.wizardPageAlternativeXSDPaths.Size = new System.Drawing.Size(456, 230);
  660. this.wizardPageAlternativeXSDPaths.TabIndex = 5;
  661. //
  662. // xsdpathsListView
  663. //
  664. this.xsdpathsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  665. | System.Windows.Forms.AnchorStyles.Left)
  666. | System.Windows.Forms.AnchorStyles.Right)));
  667. this.xsdpathsListView.DisabledColumns = ((System.Collections.ArrayList)(resources.GetObject("xsdpathsListView.DisabledColumns")));
  668. this.xsdpathsListView.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  669. this.xsdpathsListView.FullRowSelect = true;
  670. this.xsdpathsListView.GridLines = true;
  671. this.xsdpathsListView.Location = new System.Drawing.Point(0, 0);
  672. this.xsdpathsListView.Name = "xsdpathsListView";
  673. this.xsdpathsListView.Size = new System.Drawing.Size(456, 224);
  674. this.xsdpathsListView.TabIndex = 3;
  675. this.xsdpathsListView.UseCompatibleStateImageBehavior = false;
  676. this.xsdpathsListView.View = System.Windows.Forms.View.Details;
  677. //
  678. // openFileDialog1
  679. //
  680. this.openFileDialog1.Filter = "XSD Files(*.xsd)|*.xsd";
  681. //
  682. // toolTipPath
  683. //
  684. this.toolTipPath.AutomaticDelay = 1000;
  685. //
  686. // WsdlWizardForm
  687. //
  688. this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  689. this.ClientSize = new System.Drawing.Size(497, 360);
  690. this.Controls.Add(this.wsdlWizardCtrl);
  691. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
  692. this.HelpButton = true;
  693. this.Name = "WsdlWizardForm";
  694. this.ShowInTaskbar = false;
  695. this.Text = "Create a WSDL Interface Description";
  696. this.Closing += new System.ComponentModel.CancelEventHandler(this.WsdlWizardForm_Closing);
  697. this.Load += new System.EventHandler(this.WSDLWizard_Load);
  698. this.wsdlWizardCtrl.ResumeLayout(false);
  699. this.wizardPageBasicMetadata.ResumeLayout(false);
  700. this.wizardPageBasicMetadata.PerformLayout();
  701. this.wizardPageSchemaImports.ResumeLayout(false);
  702. this.groupBox2.ResumeLayout(false);
  703. this.wizardPageOperationsList.ResumeLayout(false);
  704. this.groupBox1.ResumeLayout(false);
  705. this.panel1.ResumeLayout(false);
  706. this.panel1.PerformLayout();
  707. this.wizardPageMessageMapping.ResumeLayout(false);
  708. ((System.ComponentModel.ISupportInitialize)(this.ptvServiceOperations)).EndInit();
  709. this.wizardPageAdditionalOptions.ResumeLayout(false);
  710. this.wizardPageAdditionalOptions.PerformLayout();
  711. this.wizardPageAlternativeXSDPaths.ResumeLayout(false);
  712. this.ResumeLayout(false);
  713. }
  714. #endregion
  715. #region Event handlers
  716. /// <summary>
  717. /// Performs the actions on loading the WSDL wizard.
  718. /// </summary>
  719. /// <param name="sender">Source of the event.</param>
  720. /// <param name="e">An instance of <see cref="EventArgs"/> class with the event data.</param>
  721. /// <remarks>If the round tripping mode is on, this method imports the data from the existing
  722. /// WSDL file to the UI.</remarks>
  723. private void WSDLWizard_Load(object sender, EventArgs e)
  724. {
  725. ptvServiceOperations.PaneHeaderVisible = true;
  726. // If the round tripping mode is on then import the data from the existing WSDL to the UI.
  727. if (this.roundtripMode)
  728. {
  729. if (importedContract.IsHttpBinding)
  730. {
  731. if (MessageBox.Show(this,
  732. "This WSDL contains an HTTP binding. It will be converted to a SOAP binding.\nAre you sure you want to perform this action?",
  733. "WSDL Wizard", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) ==
  734. DialogResult.Cancel)
  735. {
  736. this.DialogResult = DialogResult.Cancel;
  737. this.Close();
  738. }
  739. }
  740. ImportBasicServiceMetaData();
  741. if (!ImportSchemaImports())
  742. {
  743. this.DialogResult = DialogResult.Retry;
  744. this.Close();
  745. return;
  746. }
  747. ImportOperations();
  748. ImportAdditionalOptions();
  749. ImportEmbeddedTypes();
  750. }
  751. }
  752. /// <summary>
  753. /// Performs the actions before the summery page is loaded.
  754. /// </summary>
  755. /// <param name="sender">Source of the event.</param>
  756. /// <param name="e">An instance of <see cref="WizardPageSummaryEventArgs"/> with event data.</param>
  757. private void wsdlWizardCtrl_BeforeSummaryPageDisplayed(object sender, WizardPageSummaryEventArgs e)
  758. {
  759. openCodeGenDialog = cbCodeGenDialog.Checked;
  760. // Assign the modified alternative Xsd paths.
  761. foreach (ListViewItem li in xsdpathsListView.Items)
  762. {
  763. serviceInterfaceContract.Imports[li.Index].AlternateLocation =
  764. li.SubItems[1].Text;
  765. }
  766. }
  767. /// <summary>
  768. /// Performs the actions prior to displaying each page on the wizard control.
  769. /// </summary>
  770. /// <param name="sender">The source of the event.</param>
  771. /// <param name="e">An instance of <see cref="WizardPageDisplayedEventArgs"/> class with event data.</param>
  772. private void wsdlWizardCtrl_BeforePageDisplayed(object sender, WizardPageDisplayedEventArgs e)
  773. {
  774. // Assign the basic meta data values to the instance of InterfaceContract class.
  775. if (e.Page == wizardPageSchemaImports)
  776. {
  777. bool isValid = InterfaceContract.ValidateUri(tbNamespace.Text);
  778. if (!isValid)
  779. {
  780. DisplayError("Invalid uri for the namespace. Enter a valid uri and try again.");
  781. e.Cancel = true;
  782. return;
  783. }
  784. serviceInterfaceContract.InitializeServiceInfo(tbServiceName.Text, tbNamespace.Text, schemaNamespace, tbServiceDoc.Text);
  785. return;
  786. }
  787. if (e.Page == wizardPageOperationsList)
  788. {
  789. try
  790. {
  791. //Load the dropdown for the operation types
  792. LoadOperationsListViewWithMEP();
  793. AddSchemasToContract();
  794. }
  795. catch (Exception ex)
  796. {
  797. DisplayError(ex.Message);
  798. e.Cancel = true;
  799. return;
  800. }
  801. }
  802. if (e.Page == wizardPageMessageMapping)
  803. {
  804. try
  805. {
  806. //Update the list of operations prior to setting up the panes
  807. UpdateOperations();
  808. // Setup the dynamic UI controls for the operation - message mapping UI.
  809. SetupOperationsMessagesPanes();
  810. if (ptvServiceOperations.PaneNodes.Count > 0)
  811. {
  812. ptvServiceOperations.SelectedPaneNode = ptvServiceOperations.PaneNodes[0];
  813. ptvServiceOperations.PaneNodes[0].Expanded = true;
  814. }
  815. }
  816. catch (Exception ex)
  817. {
  818. MessageBox.Show(ex.Message);
  819. }
  820. return;
  821. }
  822. if (e.Page == wizardPageAdditionalOptions)
  823. {
  824. cbCodeGenDialog.Checked = this.roundtripMode;
  825. return;
  826. }
  827. if (e.Page == wizardPageAlternativeXSDPaths)
  828. {
  829. xsdpathsListView.Items.Clear();
  830. if (serviceInterfaceContract.Imports.Count > 0)
  831. {
  832. foreach (SchemaImport import in serviceInterfaceContract.Imports)
  833. {
  834. ListViewItem li = new ListViewItem(import.SchemaName);
  835. li.SubItems.Add(import.AlternateLocation);
  836. xsdpathsListView.Items.Add(li);
  837. }
  838. }
  839. else
  840. {
  841. wsdlWizardCtrl.AdvancePage();
  842. }
  843. return;
  844. }
  845. }
  846. /// <summary>
  847. /// Performs the validation before navigating to another page on the wizard control.
  848. /// </summary>
  849. /// <param name="sender">Source of the event.</param>
  850. /// <param name="e">An instance of <see cref="WizardPageSummaryEventArgs"/> with event data.</param>
  851. private void wsdlWizardCtrl_ValidatePage(object sender, WizardPageValidateEventArgs e)
  852. {
  853. // Validate the basic metadata.
  854. if (e.Page == wizardPageBasicMetadata)
  855. {
  856. if (tbServiceName.Text.Length == 0 || tbNamespace.Text.Length == 0)
  857. {
  858. MessageBox.Show("Please enter valid values.", "WSDL Wizard", MessageBoxButtons.OK,
  859. MessageBoxIcon.Exclamation);
  860. e.NextPage = 1;
  861. }
  862. }
  863. // Validate the operations list.
  864. if (e.Page == wizardPageOperationsList)
  865. {
  866. if (operationsListView.Items.Count == 0)
  867. {
  868. MessageBox.Show("Please specify any operations.", "WSDL Wizard", MessageBoxButtons.OK,
  869. MessageBoxIcon.Exclamation);
  870. e.NextPage = 3;
  871. }
  872. }
  873. // Validate the imported schemas list.
  874. if (e.Page == wizardPageSchemaImports)
  875. {
  876. if (serviceInterfaceContract.MessageSchemas.Count == 0 && importsListView.Items.Count == 0)
  877. {
  878. MessageBox.Show("Please add at least one XSD file.", "WSDL Wizard", MessageBoxButtons.OK,
  879. MessageBoxIcon.Exclamation);
  880. e.NextPage = 2;
  881. }
  882. }
  883. }
  884. /// <summary>
  885. /// Performs the actions after displaying a wizard page.
  886. /// </summary>
  887. /// <param name="sender">The source of the event.</param>
  888. /// <param name="e">An instance of <see cref="WizardPageEventArgs"/> with event data.</param>
  889. private void wsdlWizardCtrl_AfterPageDisplayed(object sender, WizardPageEventArgs e)
  890. {
  891. if (e.Page == wizardPageBasicMetadata)
  892. {
  893. tbServiceName.Focus();
  894. return;
  895. }
  896. if (e.Page == wizardPageAdditionalOptions)
  897. {
  898. if (ptvServiceOperations.PaneNodes.Count > 0)
  899. ptvServiceOperations.SelectedPaneNode = ptvServiceOperations.PaneNodes[0];
  900. }
  901. }
  902. /// <summary>
  903. /// Performs the actions upon closing the main wizard form.
  904. /// </summary>
  905. /// <param name="sender">The source of the event.</param>
  906. /// <param name="e">An instance of <see cref="CancelEventArgs"/> with event data.</param>
  907. /// <remarks>This method shows the confirmation dialog box , if the form is closed using the "Close" button.</remarks>
  908. private void WsdlWizardForm_Closing(object sender, CancelEventArgs e)
  909. {
  910. if (!alreadyCancelled)
  911. {
  912. if (MessageBox.Show("Do you really want to quit?",
  913. "WSDL Wizard", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  914. {
  915. e.Cancel = true;
  916. }
  917. }
  918. }
  919. /// <summary>
  920. /// Performs the necessary initialization when the wizard control loads.
  921. /// </summary>
  922. /// <param name="sender">The source of the event.</param>
  923. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  924. private void wsdlWizardCtrl_Load(object sender, EventArgs e)
  925. {
  926. // Add the columns to the operationsListView.
  927. operationsListView.Columns.Add("Operation Name", 210, HorizontalAlignment.Left);
  928. operationsListView.Columns.Add("Message Exchange Pattern", -2, HorizontalAlignment.Left);
  929. // Add the columns to the importsListView.
  930. importsListView.Columns.Add("File Name", 210, HorizontalAlignment.Left);
  931. importsListView.Columns.Add("Location", -1, HorizontalAlignment.Left);
  932. // Set the non editable columns.
  933. importsListView.DisabledColumns.Add("File Name");
  934. importsListView.DisabledColumns.Add("Location");
  935. // Add the columns to the xsdpathsListView.
  936. xsdpathsListView.Columns.Add("File Name", 210, HorizontalAlignment.Left);
  937. xsdpathsListView.Columns.Add("Alternative Path", -2, HorizontalAlignment.Left);
  938. // Set the non editable columns.
  939. xsdpathsListView.DisabledColumns.Add("File Name");
  940. // Load the default XSD to the schema imports list.
  941. string fname = schemaLocation.Substring(schemaLocation.LastIndexOf("\\") + 1);
  942. ListViewItem defaultLocation = new ListViewItem();
  943. defaultLocation.Text = fname;
  944. defaultLocation.SubItems.Add(schemaLocation);
  945. importsListView.Items.Add(defaultLocation);
  946. // Skip the wizard welcome page if the round tripping is on.
  947. if(RoundtripMode == true)
  948. {
  949. wsdlWizardCtrl.AdvancePage();
  950. tbNamespace.Enabled = false;
  951. }
  952. // Focus the first tbServiceName text box.
  953. tbServiceName.Focus();
  954. // Assign the cancel button.
  955. this.CancelButton = wsdlWizardCtrl.CancelButton;
  956. }
  957. /// <summary>
  958. /// Asks the confirmation question and quits the wizard upon the click of the "Cancel" button.
  959. /// </summary>
  960. /// <param name="sender">The source of the event.</param>
  961. /// <param name="e">An instance of <see cref="EventArgs"/> class with the event data.</param>
  962. private void wsdlWizardCtrl_Cancelled(object sender, EventArgs e)
  963. {
  964. /*
  965. if(MessageBox.Show("Do you really want to quit?",
  966. "WSDL Wizard", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
  967. {
  968. alreadyCancelled = true;
  969. this.Close();
  970. }
  971. */
  972. }
  973. /// <summary>
  974. /// Performs the actions, when the wizard's "Finish" button is clicked.
  975. /// </summary>
  976. /// <param name="sender">The source of the event.</param>
  977. /// <param name="e">An instance of <see cref="EventArgs"/> class with the event data.</param>
  978. /// <remarks>
  979. /// This method finally wraps up the necessary details and calls the
  980. /// <see cref="ServiceDescriptionEngine"/> class to generate the WSDL file.
  981. /// </remarks>
  982. private void wsdlWizardCtrl_Finished(object sender, EventArgs e)
  983. {
  984. try
  985. {
  986. // Set additional options for WSDL generation.
  987. serviceInterfaceContract.NeedsServiceElement =
  988. cbNeedsServiceElement.Checked;
  989. if (cbSoap11.Checked)
  990. {
  991. serviceInterfaceContract.Bindings |= InterfaceContract.SoapBindings.Soap11;
  992. }
  993. if (cbSoap12.Checked)
  994. {
  995. serviceInterfaceContract.Bindings |= InterfaceContract.SoapBindings.Soap12;
  996. }
  997. // Use alternative location for imports by default.
  998. serviceInterfaceContract.UseAlternateLocationForImports = true;
  999. // Call the GenerateWSDL method according to the round tripping mode.
  1000. if(this.roundtripMode)
  1001. {
  1002. wsdlLocation = ServiceDescriptionEngine.GenerateWsdl(serviceInterfaceContract,
  1003. wsdlLocation, GetXmlCommentForWSDL(), this.wsdlFile);
  1004. }
  1005. else
  1006. {
  1007. wsdlLocation = ServiceDescriptionEngine.GenerateWsdl(serviceInterfaceContract,
  1008. wsdlLocation, GetXmlCommentForWSDL());
  1009. }
  1010. this.DialogResult = DialogResult.OK;
  1011. alreadyCancelled = true;
  1012. if(!cbCodeGenDialog.Checked)
  1013. {
  1014. MessageBox.Show("WSDL successfully generated", "WsdlWizard", MessageBoxButtons.OK,
  1015. MessageBoxIcon.Information);
  1016. }
  1017. this.Close();
  1018. }
  1019. catch(WsdlGenerationException ex)
  1020. {
  1021. MessageBox.Show("An error occured while generating WSDL: " + ex.Message, "WSDL Wizard", MessageBoxButtons.OK, MessageBoxIcon.Error);
  1022. }
  1023. catch(Exception generalException)
  1024. {
  1025. MessageBox.Show("An error occured while generating WSDL: " + generalException.Message, "WSDL Wizard", MessageBoxButtons.OK, MessageBoxIcon.Error);
  1026. }
  1027. }
  1028. /// <summary>
  1029. /// CheckedChanged event handler for the cbInfer checkbox control.
  1030. /// </summary>
  1031. /// <param name="sender">Source of the event.</param>
  1032. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  1033. /// <remarks>This checkbox specifies whether to infer the operations or not.</remarks>
  1034. private void cbInfer_CheckedChanged(object sender, System.EventArgs e)
  1035. {
  1036. if (cbInfer.Checked)
  1037. {
  1038. InferOperations();
  1039. }
  1040. else
  1041. {
  1042. //We have unchecked the box so remove all of them
  1043. RemoveInferredOperations();
  1044. }
  1045. }
  1046. /// <summary>
  1047. /// Adds an operation to the operationsListView.
  1048. /// </summary>
  1049. /// <param name="sender">The source of the event.</param>
  1050. /// <param name="e">An instance of <see cref="LinkLabelLinkClickedEventArgs"/> class with Event data.</param>
  1051. private void llAddOperation_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  1052. {
  1053. // create a default entry (name, MEP) which can then be edited by the user
  1054. ListViewItem listViewItem1 =
  1055. new ListViewItem(new string[] {
  1056. "Operation" + operationCount,
  1057. Mep.RequestResponse.ToString(),
  1058. "",
  1059. ""},
  1060. -1);
  1061. operationsListView.Items.AddRange(
  1062. new ListViewItem[] { listViewItem1 });
  1063. // we cannot add to the serviceinterfacecontract at this time because
  1064. // there is only default text and the change of the default is done inside
  1065. // the control. So we leave things as they are now and update the
  1066. // operations collection when we click NEXT
  1067. // increment the operation counter
  1068. operationCount++;
  1069. }
  1070. /// <summary>
  1071. /// Removes an operation from the operationsListView.
  1072. /// </summary>
  1073. /// <param name="sender">The source of the event.</param>
  1074. /// <param name="e">An instance of <see cref="LinkLabelLinkClickedEventArgs"/> class with Event data.</param>
  1075. /// <remarks>
  1076. /// This method will remove the first item of the selected items collection. If no item is selected then
  1077. /// it removes the last item available in the list.
  1078. /// </remarks>
  1079. private void llRemoveOperation_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  1080. {
  1081. if (operationsListView.Items.Count > 0)
  1082. {
  1083. // Remove the first item of the selected items.
  1084. if (operationsListView.SelectedItems.Count > 0)
  1085. {
  1086. while (operationsListView.SelectedItems.Count != 0)
  1087. {
  1088. ListViewItem lvi = operationsListView.SelectedItems[0];
  1089. operationsListView.Items.Remove(lvi);
  1090. //Find the corresponding operation in IC and remove it
  1091. string opName = lvi.Text;
  1092. Operation operationToRemove = serviceInterfaceContract.Operations.Single(o => o.Name == opName);
  1093. serviceInterfaceContract.Operations.Remove(operationToRemove);
  1094. }
  1095. }
  1096. else
  1097. {
  1098. //TODO:(SB): verify this is really needed. Could cause problems for the unwary user
  1099. // If anything is not selected, remove the last item on the list.
  1100. int indexOfItemToRemove = operationsListView.Items.Count - 1;
  1101. operationsListView.Items.RemoveAt(indexOfItemToRemove);
  1102. serviceInterfaceContract.Operations.RemoveAt(indexOfItemToRemove);
  1103. operationCount--;
  1104. }
  1105. }
  1106. }
  1107. /// <summary>
  1108. /// Handles the SelectedIndexChanged event of the dynamically created combo box.
  1109. /// </summary>
  1110. /// <param name="sender">The source of the event.</param>
  1111. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  1112. /// <remarks>This method changes the selected operation's in/out message parameters to the
  1113. /// newly selected values.</remarks>
  1114. private void DynamicComboBox_SelectedIndexChanged(object sender, EventArgs e)
  1115. {
  1116. ComboBox currentCombo = sender as ComboBox;
  1117. // Check whether the dynamic combo belongs to an inbound message or an outbound message.
  1118. if(currentCombo.Name.StartsWith("inMessageParamsCombo"))
  1119. {
  1120. string tail = currentCombo.Name.Substring(20);
  1121. int index = int.Parse(tail);
  1122. // Select the corresponding operation for the selected message.
  1123. Operation currentOperation = serviceInterfaceContract.Operations[index];
  1124. // Change the input message of the operation.
  1125. currentOperation.Input.Element = serviceInterfaceContract.MessageSchemas[currentCombo.SelectedIndex];
  1126. }
  1127. else if(currentCombo.Name.StartsWith("outMessageParamsCombo"))
  1128. {
  1129. string tail = currentCombo.Name.Substring(21);
  1130. int index = int.Parse(tail);
  1131. // Select the corresponding operation for the selected message.
  1132. Operation currentOperation = serviceInterfaceContract.Operations[index];
  1133. // Change the input message of the operation.
  1134. currentOperation.Output.Element = serviceInterfaceContract.MessageSchemas[currentCombo.SelectedIndex];
  1135. }
  1136. // this is a hack to 'convince' the combo box that the Text property has changed - don't ask! ...
  1137. ((ComboBox)sender).Text = "42";
  1138. }
  1139. /// <summary>
  1140. /// Performs the actions after clicking the "llAddImport" link label.
  1141. /// </summary>
  1142. /// <param name="sender">The source of the event.</param>
  1143. /// <param name="e">An instance of <see cref="LinkLabelLinkClickedEventArgs"/> class with event data.</param>
  1144. /// <remarks>This allows the user to select the XSD files using a file open dialog box and add them
  1145. /// to the importsListView control.</remarks>
  1146. private void llAddImport_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
  1147. {
  1148. // Set the default location and the filter for the .xsd files.
  1149. openFileDialog1.InitialDirectory = this.currentFolder;
  1150. openFileDialog1.Filter = "XSD Files(*.xsd)|*.xsd";
  1151. if(openFileDialog1.ShowDialog() == DialogResult.OK)
  1152. {
  1153. // Check whether the current item exists on the importsListView and add it to the list if it's not.
  1154. string fname = string.Empty;
  1155. fname = openFileDialog1.FileName.Substring(openFileDialog1.FileName.LastIndexOf("\\") + 1);
  1156. ListViewItem li = new ListViewItem(fname);
  1157. li.SubItems.Add(openFileDialog1.FileName);
  1158. // Change the location of the XSD if it already exists on the list.
  1159. foreach(ListViewItem eli in importsListView.Items)
  1160. {
  1161. if(eli.Text.ToLower() == li.Text.ToLower())
  1162. {
  1163. eli.SubItems[1].Text = openFileDialog1.FileName;
  1164. return;
  1165. }
  1166. }
  1167. importsListView.Items.Add(li);
  1168. }
  1169. }
  1170. /// <summary>
  1171. /// Performs the actions after clicking the llRemoveImport link label.
  1172. /// </summary>
  1173. /// <param name="sender">The source of the event.</param>
  1174. /// <param name="e">An instance of <see cref="LinkLabelLinkClickedEventArgs"/> with event data.</param>
  1175. /// <remarks>This action removes the items from the importsListView control.</remarks>
  1176. private void llRemoveImport_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
  1177. {
  1178. // Delete the selected items.
  1179. while(importsListView.SelectedItems.Count != 0)
  1180. {
  1181. importsListView.SelectedItems[0].Remove();
  1182. }
  1183. }
  1184. /// <summary>
  1185. /// Displays a tool tip about the list item underneath the mouse pointer.
  1186. /// </summary>
  1187. /// <param name="sender">The source of the event.</param>
  1188. /// <param name="e">An instance of <see cref="MouseEventArgs"/> class with event data.</param>
  1189. private void importsListView_MouseMove(object sender,
  1190. System.Windows.Forms.MouseEventArgs e)
  1191. {
  1192. ListViewItem li = importsListView.GetItemAt(e.X,e.Y);
  1193. if(li == null)
  1194. {
  1195. toolTipPath.Active = false;
  1196. }
  1197. else
  1198. {
  1199. toolTipPath.Active = true;
  1200. toolTipPath.SetToolTip(importsListView,li.SubItems[1].Text);
  1201. }
  1202. }
  1203. /// <summary>
  1204. /// CheckedChanged event handler for the cbCodeGenDialog checkbox control.
  1205. /// </summary>
  1206. /// <param name="sender">Source of the event.</param>
  1207. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  1208. /// <remarks>This checkbox specifies whether the code generation dialog must start right after the wizard or not.
  1209. /// If the user is in the round-tripping mode this checkbox is selected by default and it verifies if the user tries to uncheck it.</remarks>
  1210. private void cbCodeGenDialog_CheckedChanged(object sender, System.EventArgs e)
  1211. {
  1212. if(!cbCodeGenDialog.Checked && this.roundtripMode)
  1213. {
  1214. if(MessageBox.Show(this,
  1215. "You need to regenerate the code to reflect the changes which have been made in the contract. Are you sure you do not want to start code generation immediately after the wizard?",
  1216. "WZDL Wizard",
  1217. MessageBoxButtons.YesNo,
  1218. MessageBoxIcon.Question) == DialogResult.No)
  1219. {
  1220. cbCodeGenDialog.Checked = true;
  1221. }
  1222. }
  1223. }
  1224. #endregion
  1225. #region Private methods.
  1226. /// <summary>
  1227. /// Prepares the dynamic controls for the operations-message parameters mapping UI.
  1228. /// </summary>
  1229. private void DisplayError(string error)
  1230. {
  1231. MessageBox.Show(this,
  1232. error,
  1233. "WSDL Wizard", MessageBoxButtons.OK, MessageBoxIcon.Error);
  1234. }
  1235. /// <summary>
  1236. /// Loads the operations list view with the available Message Exchange Patterns
  1237. /// </summary>
  1238. private void LoadOperationsListViewWithMEP()
  1239. {
  1240. List<string> options = new List<string>();
  1241. options.Add(Mep.OneWay.ToString());
  1242. options.Add(Mep.RequestResponse.ToString());
  1243. operationsListView.LoadDropDownOptions(options);
  1244. }
  1245. private void AddSchemasToContract()
  1246. {
  1247. //Get all the selected schemas from the list view
  1248. NameValueCollection schemasAndLocations = new NameValueCollection();
  1249. string schemaName = String.Empty;
  1250. string schemaLocation = String.Empty;
  1251. // Clear the existing items.
  1252. //this.messageSchemas.Clear();
  1253. //this.headerSchemas.Clear();
  1254. this.importedSchemaNamespaces.Clear();
  1255. this.serviceInterfaceContract.Imports.Clear();
  1256. foreach (ListViewItem importItem in importsListView.Items)
  1257. {
  1258. schemaName = importItem.SubItems[0].Text;
  1259. schemaLocation = importItem.SubItems[1].Text;
  1260. schemasAndLocations.Add(schemaName, schemaLocation);
  1261. }
  1262. serviceInterfaceContract.AddSchemasToContract(schemasAndLocations, wsdlLocation, this.projectRootDirectory);
  1263. }
  1264. private void InferOperations()
  1265. {
  1266. List<Operation> ops = serviceInterfaceContract.InferOperations();
  1267. foreach (Operation op in ops)
  1268. {
  1269. // Add the operation to the list view.
  1270. ListViewItem listViewItem1 =
  1271. new ListViewItem(new string[] {
  1272. op.Name,
  1273. op.Mep.ToString(),
  1274. "",
  1275. ""},
  1276. -1);
  1277. listViewItem1.Tag = op.Name;
  1278. operationsListView.Items.AddRange(
  1279. new ListViewItem[] { listViewItem1 });
  1280. operationCount++;
  1281. }
  1282. }
  1283. /// <summary>
  1284. /// Removes the inferred operations.
  1285. /// </summary>
  1286. private void RemoveInferredOperations()
  1287. {
  1288. int index = 0;
  1289. while (index != operationsListView.Items.Count)
  1290. {
  1291. bool removed = false;
  1292. ListViewItem li = operationsListView.Items[index];
  1293. foreach (Operation op in serviceInterfaceContract.Operations)
  1294. {
  1295. if (op.Name == li.Text)
  1296. {
  1297. li.Remove();
  1298. removed = true;
  1299. serviceInterfaceContract.Operations.Remove(op);
  1300. break;
  1301. }
  1302. }
  1303. if (!removed)
  1304. {
  1305. index++;
  1306. }
  1307. }
  1308. //inferOperations.Clear();
  1309. serviceInterfaceContract.Operations.Clear();
  1310. }
  1311. /// <summary>
  1312. /// Updates the list of operations prior to setting up the message panes
  1313. /// </summary>
  1314. private void UpdateOperations()
  1315. {
  1316. int index = 0;
  1317. for(index =0; index < operationsListView.Items.Count; index++)
  1318. {
  1319. ListViewItem li = operationsListView.Items[index];
  1320. string currOpName = li.Text;
  1321. string currMepText = li.SubItems[1].Text;
  1322. Mep currMep = (Mep) System.Enum.Parse(typeof (Mep), currMepText);
  1323. // There may be new operations added. So for the existing ones we first update
  1324. if (index < serviceInterfaceContract.Operations.Count)
  1325. {
  1326. //Find the corresponding operation from the service contract
  1327. Operation op = serviceInterfaceContract.Operations[index];
  1328. // if there is a valid one, then update its components (if different)
  1329. if (op != null)
  1330. {
  1331. if (!op.Name.Equals(currOpName))
  1332. {
  1333. op.Name = currOpName;
  1334. }
  1335. if (op.Mep != currMep)
  1336. {
  1337. op.Mep = currMep;
  1338. }
  1339. }
  1340. }
  1341. else
  1342. {
  1343. // we have a new operation to be added
  1344. Operation opToAdd = new Operation();
  1345. opToAdd.Name = currOpName;
  1346. opToAdd.Mep = currMep;
  1347. serviceInterfaceContract.Operations.Add(opToAdd);
  1348. }
  1349. }
  1350. }
  1351. private void SetupOperationsMessagesPanes()
  1352. {
  1353. int i = 0;
  1354. Operation op = null;
  1355. ((ISupportInitialize)ptvServiceOperations).BeginInit();
  1356. ptvServiceOperations.SuspendLayout();
  1357. for(i=0; i< serviceInterfaceContract.Operations.Count; i++)
  1358. {
  1359. op = serviceInterfaceContract.Operations[i];
  1360. if(!OperationHasPropertyPane(op.Name))
  1361. {
  1362. CreateOperationPanes(i, op);
  1363. }
  1364. //i++;
  1365. }
  1366. oldOperations = new List<Operation>(serviceInterfaceContract.Operations);
  1367. ((ISupportInitialize)ptvServiceOperations).EndInit();
  1368. ptvServiceOperations.ResumeLayout(false);
  1369. }
  1370. private bool OperationHasPropertyPane(string opName)
  1371. {
  1372. bool found = false;
  1373. foreach (PaneNode proPane in ptvServiceOperations.PaneNodes)
  1374. {
  1375. if (opName.Equals((string)proPane.PropertyPane.Tag))
  1376. {
  1377. found = true;
  1378. break;
  1379. }
  1380. }
  1381. return found;
  1382. }
  1383. #region "Operation and related controls"
  1384. private Operation CreateOperation(Operation op)
  1385. {
  1386. string opName = string.Empty;
  1387. Operation operation = new Operation();
  1388. operation.Name = op.Name;
  1389. operation.Mep = op.Mep;
  1390. operation.Documentation = "";
  1391. opName = operation.Name;
  1392. string opNamePrefix = opName.Substring(0, 1);
  1393. opNamePrefix = opNamePrefix.ToLower(CultureInfo.CurrentCulture);
  1394. opName = opName.Substring(1, opName.Length - 1);
  1395. opName = opNamePrefix + opName;
  1396. return operation;
  1397. }
  1398. private PropertyPane CreateOperationPropertyPane(Operation operation, int i)
  1399. {
  1400. PropertyPane propPaneOp = new PropertyPane();
  1401. propPaneOp.Name = "propPaneOp" + i;
  1402. propPaneOp.Text = "Operation " + operation.Name;
  1403. propPaneOp.Tag = operation.Name;
  1404. return propPaneOp;
  1405. }
  1406. private TextBox AddOpDocTextBox(Operation operation, int opIndex, out Label opDocLabel)
  1407. {
  1408. TextBox opDocTextBox = new TextBox();
  1409. opDocTextBox.Location = new Point(8, 148);
  1410. opDocTextBox.Multiline = true;
  1411. opDocTextBox.Name = "outDocTextBox" + opIndex;
  1412. opDocTextBox.Size = new Size(135, 0);
  1413. opDocTextBox.DataBindings.Add("Text", operation, "Documentation");
  1414. opDocTextBox.Anchor = AnchorStyles.Left | AnchorStyles.Top |
  1415. AnchorStyles.Right | AnchorStyles.Bottom;
  1416. opDocLabel = new Label();
  1417. opDocLabel.Location = new Point(8, 128);
  1418. opDocLabel.Name = "outDocLabel" + opIndex;
  1419. opDocLabel.Size = new Size(88, 23);
  1420. opDocLabel.Text = "Documentation:";
  1421. return opDocTextBox;
  1422. }
  1423. private void CreateOperationPanes(int opIndex, Operation operation)
  1424. {
  1425. string inputMessageName = String.Empty;
  1426. string outputMessageName = String.Empty;
  1427. Message inMessage = null;
  1428. Message outMessage = null;
  1429. MessageHeader inHeader = null;
  1430. MessageHeader outHeader = null;
  1431. PropertyPane propPaneOp = null;
  1432. PropertyPane propPaneInMsg = null;
  1433. PropertyPane propPaneOutMsg = null;
  1434. //Operation operation = CreateOperation(op);
  1435. // TODO:(SB): Review this. We need it to be safe from duplicates, but the event of
  1436. // adding the message to the collection is not easy to trap always.
  1437. operation.MessagesCollection.Clear();
  1438. inMessage = AddInputMessage(operation, out inputMessageName);
  1439. inHeader = AddInputMessageHeader(inputMessageName);
  1440. operation.Input = inMessage;
  1441. //serviceInterfaceContract.Operations.Add(operation);
  1442. propPaneOp = CreateOperationPropertyPane(operation, opIndex);
  1443. ptvServiceOperations.PaneNodes.Add(propPaneOp);
  1444. propPaneInMsg = AttachOperationInputPane(inputMessageName, opIndex, propPaneOp);
  1445. // Setup dynamic GUI controls for the pane - Operation
  1446. Label opDocLabel;
  1447. TextBox opDocTextBox = AddOpDocTextBox(operation, opIndex, out opDocLabel);
  1448. propPaneOp.Controls.Add(opDocTextBox);
  1449. propPaneOp.Controls.Add(opDocLabel);
  1450. // Setup dynamic GUI controls for the pane - InMessage
  1451. string originalOperationName = CreateInputPane(operation.Name, operation, inputMessageName, inMessage, opIndex, opDocTextBox, propPaneInMsg, inHeader);
  1452. // Setup dynamic GUI controls for the pane - OutMessage
  1453. if (operation.Mep == Mep.RequestResponse)
  1454. {
  1455. outMessage = AddOutputMessage(operation, out outputMessageName);
  1456. outHeader = AddOutputMessageHeader(outputMessageName);
  1457. propPaneOutMsg = AttachOperationOutputPane(opIndex, propPaneOp, outputMessageName);
  1458. CreateOutputPane(operation, opIndex, opDocTextBox, outMessage, propPaneOutMsg, originalOperationName, outHeader);
  1459. }
  1460. }
  1461. #endregion
  1462. #region "InputMessage and RelatedControls"
  1463. private Message AddInputMessage(Operation operation, out string inputMessageName)
  1464. {
  1465. Message inMessage = new Message();
  1466. inMessage.Name = operation.Name + "In";
  1467. inMessage.Documentation = "";
  1468. //TODO:(SB): Is this default assignment wise?
  1469. inMessage.Element = serviceInterfaceContract.MessageSchemas[0];
  1470. //check if the operation already has this as we dont want duplicates
  1471. if (!operation.MessagesCollection.Contains(inMessage))
  1472. {
  1473. operation.MessagesCollection.Add(inMessage);
  1474. }
  1475. inputMessageName = inMessage.Name;
  1476. return inMessage;
  1477. }
  1478. private MessageHeader AddInputMessageHeader(string inputMessageName)
  1479. {
  1480. MessageHeader inHeader = new MessageHeader();
  1481. inHeader.Name = inputMessageName + "Header";
  1482. inHeader.Message = inputMessageName + "Header";
  1483. return inHeader;
  1484. }
  1485. private TextBox SetupInputMessageDynamicControls(string inputMessageName, int opIndex, out Label inMessageParameterLabel, out CheckBox inMessageNameCheckBox, out TextBox inMessageNameTextBox, out ComboBox inMessageParamsCombo)
  1486. {
  1487. TextBox inDocTextBox = CreateDocTextBox("inDocTextBox" , opIndex);
  1488. inMessageParameterLabel = CreateMessageParameterLabel("inMessageParameterLabel", opIndex);
  1489. inMessageNameCheckBox = CreateMessageNameCheckBox("inMessageNameCheckBox" , opIndex);
  1490. inMessageNameTextBox = new TextBox();
  1491. inMessageNameTextBox.Location = new Point(8, 67);
  1492. inMessageNameTextBox.Name = "inMessageNameTextBox" + opIndex;
  1493. inMessageNameTextBox.Size = new Size(142, 20);
  1494. inMessageNameTextBox.Enabled = false;
  1495. inMessageNameTextBox.Text = inputMessageName;
  1496. inMessageNameTextBox.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
  1497. inMessageParamsCombo = new ComboBox();
  1498. inMessageParamsCombo.DropDownStyle = ComboBoxStyle.DropDownList;
  1499. inMessageParamsCombo.Location = new Point(65, 5);
  1500. inMessageParamsCombo.Name = "inMessageParamsCombo" + opIndex;
  1501. inMessageParamsCombo.Size = new Size(80, 21);
  1502. inMessageParamsCombo.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
  1503. // Fill the combo box with the Message values.
  1504. foreach (SchemaElement element in serviceInterfaceContract.MessageSchemas)
  1505. {
  1506. inMessageParamsCombo.Items.Add(element.ElementName);
  1507. }
  1508. inMessageParamsCombo.SelectedIndex = 0;
  1509. return inDocTextBox;
  1510. }
  1511. private CheckBox CreateMessageNameCheckBox(string controlName, int opIndex)
  1512. {
  1513. CheckBox inMessageNameCheckBox;
  1514. inMessageNameCheckBox = new CheckBox();
  1515. inMessageNameCheckBox.Location = new Point(9, 44);
  1516. inMessageNameCheckBox.Name = controlName + opIndex;
  1517. inMessageNameCheckBox.Text = "Message name (optional)";
  1518. inMessageNameCheckBox.Size = new Size(220, 25);
  1519. return inMessageNameCheckBox;
  1520. }
  1521. private Label CreateMessageParameterLabel(string controlName, int opIndex)
  1522. {
  1523. Label inMessageParameterLabel;
  1524. inMessageParameterLabel = new Label();
  1525. inMessageParameterLabel.Location = new Point(6, 5);
  1526. inMessageParameterLabel.Name = controlName + opIndex;
  1527. inMessageParameterLabel.Size = new Size(55, 33);
  1528. inMessageParameterLabel.Text = "Message body:";
  1529. return inMessageParameterLabel;
  1530. }
  1531. private TextBox CreateDocTextBox(string controlName, int opIndex)
  1532. {
  1533. TextBox inDocTextBox = new TextBox();
  1534. inDocTextBox.Location = new Point(8, 168);
  1535. inDocTextBox.Multiline = true;
  1536. inDocTextBox.Name = controlName + opIndex;
  1537. inDocTextBox.Size = new Size(135, 0);
  1538. inDocTextBox.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
  1539. return inDocTextBox;
  1540. }
  1541. private PropertyPane AttachOperationInputPane(string inputMessageName, int i, PropertyPane propPaneOp)
  1542. {
  1543. PropertyPane propPaneInMsg = new PropertyPane();
  1544. propPaneInMsg.Name = "propPaneInMsg" + i;
  1545. propPaneInMsg.Text = "Message " + inputMessageName;
  1546. PaneNode operationPaneNode = propPaneOp.PaneNodes.Add(propPaneInMsg);
  1547. propPaneOp.PaneNode.Expanded = true;
  1548. return propPaneInMsg;
  1549. }
  1550. private string CreateInputPane(string opName, Operation operation, string inputMessageName, Message inMessage, int opIndex, TextBox opDocTextBox, PropertyPane propPaneInMsg, MessageHeader inHeader)
  1551. {
  1552. Label inMessageParameterLabel;
  1553. CheckBox inMessageNameCheckBox;
  1554. TextBox inMessageNameTextBox;
  1555. ComboBox inMessageParamsCombo;
  1556. TextBox inDocTextBox = SetupInputMessageDynamicControls(inputMessageName, opIndex, out inMessageParameterLabel, out inMessageNameCheckBox, out inMessageNameTextBox, out inMessageParamsCombo);
  1557. // Import the parameters from WSDL file for round tripping.
  1558. string originalOperationName = "";
  1559. if (opName != null)
  1560. {
  1561. originalOperationName = opName;
  1562. }
  1563. ImportMessageParameter(operation, false, inMessageParamsCombo,
  1564. inMessageNameCheckBox, inMessageNameTextBox, propPaneInMsg,
  1565. opDocTextBox, inDocTextBox, originalOperationName);
  1566. // Attach the dynamic combo box event handler.
  1567. inMessageParamsCombo.SelectedIndexChanged +=
  1568. new EventHandler(DynamicComboBox_SelectedIndexChanged);
  1569. CheckBox inMessageHeaderCheckBox = CreateInMessageHeaderCheckBox(opIndex);
  1570. ComboBox inMessageHeaderCombo = CreateInMessageHeaderCombo(opIndex);
  1571. // Import headers from WSDL file for round tripping.
  1572. List<Message> addedInHeaderMsgs = ImportMessageHeaders(operation, inMessage,inMessageHeaderCombo, inMessageHeaderCheckBox, false);
  1573. // Attach the dynamic combo box event handler.
  1574. inMessageHeaderCombo.SelectedIndexChanged +=
  1575. new EventHandler(DynamicComboBox_SelectedIndexChanged);
  1576. LinkLabel inRemoveHeaderLink = CreateInRemoveHeaderLink(addedInHeaderMsgs);
  1577. // inRemoveHeaderLink.Anchor = AnchorStyles.Right;
  1578. // Initialize the dynamic control controllers.
  1579. MessagePaneLabelController mplcIn =
  1580. new MessagePaneLabelController(inMessageNameTextBox, propPaneInMsg);
  1581. MessageNameTextBoxController mntbcIn =
  1582. new MessageNameTextBoxController(inMessageNameTextBox, inMessageNameCheckBox, inMessage, propPaneInMsg);
  1583. InHeaderComboBoxController hcbcIn =
  1584. new InHeaderComboBoxController(inMessageHeaderCombo, inMessageHeaderCheckBox,
  1585. inMessageNameTextBox, operation, inMessage, inHeader, serviceInterfaceContract.HeaderSchemas,
  1586. inRemoveHeaderLink, addedInHeaderMsgs);
  1587. OperationDocumentationTextBoxController odtbc =
  1588. new OperationDocumentationTextBoxController(opDocTextBox, operation);
  1589. MessageDocumentationTextBoxController mdtbc =
  1590. new MessageDocumentationTextBoxController(inDocTextBox, inMessage);
  1591. Label inDocLabel = CreateInDocLabel(opIndex);
  1592. // Finally add the controls to the container.
  1593. propPaneInMsg.Controls.Add(inDocTextBox);
  1594. propPaneInMsg.Controls.Add(inDocLabel);
  1595. propPaneInMsg.Controls.Add(inMessageParameterLabel);
  1596. propPaneInMsg.Controls.Add(inMessageNameTextBox);
  1597. propPaneInMsg.Controls.Add(inMessageParameterLabel);
  1598. propPaneInMsg.Controls.Add(inMessageParamsCombo);
  1599. propPaneInMsg.Controls.Add(inMessageNameCheckBox);
  1600. propPaneInMsg.Controls.Add(inMessageHeaderCombo);
  1601. propPaneInMsg.Controls.Add(inMessageHeaderCheckBox);
  1602. propPaneInMsg.Controls.Add(inRemoveHeaderLink);
  1603. return originalOperationName;
  1604. }
  1605. private Label CreateInDocLabel(int opIndex)
  1606. {
  1607. Label inDocLabel = new Label();
  1608. inDocLabel.Location = new Point(8, 149);
  1609. inDocLabel.Name = "inDocLabel" + opIndex;
  1610. inDocLabel.Size = new Size(88, 23);
  1611. inDocLabel.Text = "Documentation:";
  1612. return inDocLabel;
  1613. }
  1614. private CheckBox CreateInMessageHeaderCheckBox(int opIndex)
  1615. {
  1616. CheckBox inMessageHeaderCheckBox = new CheckBox();
  1617. inMessageHeaderCheckBox.Location = new Point(9, 95);
  1618. inMessageHeaderCheckBox.Name = "inMessageHeaderCheckBox" + opIndex;
  1619. inMessageHeaderCheckBox.Text = "Message headers (optional)";
  1620. inMessageHeaderCheckBox.Size = new Size(181, 25);
  1621. return inMessageHeaderCheckBox;
  1622. }
  1623. private ComboBox CreateInMessageHeaderCombo(int opIndex)
  1624. {
  1625. ComboBox inMessageHeaderCombo = new ComboBox();
  1626. inMessageHeaderCombo.DropDownStyle = ComboBoxStyle.DropDownList;
  1627. inMessageHeaderCombo.Location = new Point(8, 120);
  1628. inMessageHeaderCombo.Enabled = false;
  1629. inMessageHeaderCombo.Name = "inMessageHeaderCombo" + opIndex;
  1630. inMessageHeaderCombo.Size = new Size(100, 21);
  1631. inMessageHeaderCombo.Items.Add("<New...>");
  1632. inMessageHeaderCombo.SelectedIndex = 0;
  1633. inMessageHeaderCombo.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
  1634. return inMessageHeaderCombo;
  1635. }
  1636. private LinkLabel CreateInRemoveHeaderLink(List<Message> addedInHeaderMsgs)
  1637. {
  1638. LinkLabel inRemoveHeaderLink = new LinkLabel();
  1639. inRemoveHeaderLink.Text = "Remove";
  1640. inRemoveHeaderLink.Location = new Point(193, 95);
  1641. inRemoveHeaderLink.Size = new Size(64, 25);
  1642. inRemoveHeaderLink.TextAlign = ContentAlignment.MiddleRight;
  1643. inRemoveHeaderLink.Visible = (addedInHeaderMsgs != null);
  1644. return inRemoveHeaderLink;
  1645. }
  1646. #endregion
  1647. #region "OutputMessage and Related Controls"
  1648. private Message AddOutputMessage(Operation operation, out string outputMessageName)
  1649. {
  1650. Message outMessage = new Message();
  1651. outMessage.Name = operation.Name + "Out";
  1652. outMessage.Documentation = "";
  1653. outMessage.Element = serviceInterfaceContract.MessageSchemas[0];
  1654. if (!operation.MessagesCollection.Contains(outMessage))
  1655. {
  1656. operation.MessagesCollection.Add(outMessage);
  1657. }
  1658. outputMessageName = outMessage.Name;
  1659. return outMessage;
  1660. }
  1661. private MessageHeader AddOutputMessageHeader(string outputMessageName)
  1662. {
  1663. MessageHeader outHeader;
  1664. outHeader = new MessageHeader();
  1665. outHeader.Name = outputMessageName + "Header";
  1666. outHeader.Message = outputMessageName + "Header";
  1667. return outHeader;
  1668. }
  1669. private PropertyPane AttachOperationOutputPane(int opIndex, PropertyPane propPaneOp, string outputMessageName)
  1670. {
  1671. PropertyPane propPaneOutMsg = new PropertyPane();
  1672. propPaneOutMsg.Name = "propPaneOutMsg" + opIndex;
  1673. propPaneOutMsg.Text = "Message " + outputMessageName;
  1674. propPaneOp.PaneNodes.Add(propPaneOutMsg);
  1675. propPaneOp.PaneNode.Expanded = true;
  1676. return propPaneOutMsg;
  1677. }
  1678. private void CreateOutputPane(Operation operation, int opIndex, TextBox opDocTextBox, Message outMessage, PropertyPane propPaneOutMsg, string originalOperationName, MessageHeader outHeader)
  1679. {
  1680. Label outMessageParameterLabel;
  1681. CheckBox outMessageNameCheckBox;
  1682. TextBox outMessageNameTextBox;
  1683. ComboBox outMessageParamsCombo;
  1684. TextBox outDocTextBox = SetupOutputMessageDynamicControls(opIndex, outMessage, out outMessageParameterLabel, out outMessageNameCheckBox, out outMessageNameTextBox, out outMessageParamsCombo);
  1685. operation.Output = outMessage;
  1686. // Import the parameters from an existing WSDL file for round tripping.
  1687. ImportMessageParameter(operation, true, outMessageParamsCombo, outMessageNameCheckBox,
  1688. outMessageNameTextBox, propPaneOutMsg, opDocTextBox, outDocTextBox, originalOperationName);
  1689. // Attach the dynamic combo box event handler.
  1690. outMessageParamsCombo.SelectedIndexChanged +=
  1691. new EventHandler(DynamicComboBox_SelectedIndexChanged);
  1692. CheckBox outMessageHeaderCheckBox = CreateOutMessageHeaderCheckBox(opIndex);
  1693. ComboBox outMessageHeaderCombo = CreateOutMessageHeaderCombo(opIndex);
  1694. // Import headers from an existing WSDL file for round tripping.
  1695. List<Message> addedOutHeaderMsgs = ImportMessageHeaders(operation, outMessage,
  1696. outMessageHeaderCombo, outMessageHeaderCheckBox, true);
  1697. // Attach the dynamic combo box event handler.
  1698. outMessageHeaderCombo.SelectedIndexChanged +=
  1699. new EventHandler(DynamicComboBox_SelectedIndexChanged);
  1700. LinkLabel outRemoveHeaderLink = CreateOutRemoveHeaderLink(addedOutHeaderMsgs);
  1701. // outRemoveHeaderLink.Anchor = AnchorStyles.Right;
  1702. // Initialize the dynamic control controllers.
  1703. MessagePaneLabelController mplcOut =
  1704. new MessagePaneLabelController(outMessageNameTextBox, propPaneOutMsg);
  1705. MessageNameTextBoxController mntbcOut =
  1706. new MessageNameTextBoxController(outMessageNameTextBox, outMessageNameCheckBox,
  1707. outMessage, propPaneOutMsg);
  1708. OutHeaderComboBoxController hcbcOut =
  1709. new OutHeaderComboBoxController(outMessageHeaderCombo, outMessageHeaderCheckBox,
  1710. outMessageNameTextBox, operation, outMessage, outHeader, serviceInterfaceContract.HeaderSchemas,
  1711. outRemoveHeaderLink, addedOutHeaderMsgs);
  1712. MessageDocumentationTextBoxController outdtbc =
  1713. new MessageDocumentationTextBoxController(outDocTextBox, outMessage);
  1714. Label outDocLabel = CreateOutDocLabel(opIndex);
  1715. // Finally add the generated controls to the container.
  1716. propPaneOutMsg.Controls.Add(outDocTextBox);
  1717. propPaneOutMsg.Controls.Add(outDocLabel);
  1718. propPaneOutMsg.Controls.Add(outMessageParameterLabel);
  1719. propPaneOutMsg.Controls.Add(outMessageNameTextBox);
  1720. propPaneOutMsg.Controls.Add(outMessageParameterLabel);
  1721. propPaneOutMsg.Controls.Add(outMessageParamsCombo);
  1722. propPaneOutMsg.Controls.Add(outMessageNameCheckBox);
  1723. propPaneOutMsg.Controls.Add(outMessageHeaderCombo);
  1724. propPaneOutMsg.Controls.Add(outMessageHeaderCheckBox);
  1725. propPaneOutMsg.Controls.Add(outRemoveHeaderLink);
  1726. }
  1727. private TextBox SetupOutputMessageDynamicControls(int opIndex, Message outMessage, out Label outMessageParameterLabel, out CheckBox outMessageNameCheckBox, out TextBox outMessageNameTextBox, out ComboBox outMessageParamsCombo)
  1728. {
  1729. TextBox outDocTextBox = new TextBox();
  1730. outDocTextBox.Location = new Point(8, 165);
  1731. outDocTextBox.Multiline = true;
  1732. outDocTextBox.Name = "outDocTextBox" + opIndex;
  1733. outDocTextBox.Size = new Size(135, 0);
  1734. outDocTextBox.DataBindings.Add("Text", outMessage, "Documentation");
  1735. outDocTextBox.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right |
  1736. AnchorStyles.Bottom;
  1737. outMessageParameterLabel = new Label();
  1738. outMessageParameterLabel.Location = new Point(6, 5);
  1739. outMessageParameterLabel.Name = "outMessageParameterLabel" + opIndex;
  1740. outMessageParameterLabel.Size = new Size(55, 33);
  1741. outMessageParameterLabel.Text = "Message body:";
  1742. outMessageNameCheckBox = new CheckBox();
  1743. outMessageNameCheckBox.Location = new Point(9, 44);
  1744. outMessageNameCheckBox.Name = "outMessageNameCheckBox" + opIndex;
  1745. outMessageNameCheckBox.Text = "Message name (optional)";
  1746. outMessageNameCheckBox.Size = new Size(220, 25);
  1747. outMessageNameTextBox = new TextBox();
  1748. outMessageNameTextBox.Location = new Point(8, 67);
  1749. outMessageNameTextBox.Name = "outMessageNameTextBox" + opIndex;
  1750. outMessageNameTextBox.Size = new Size(142, 20);
  1751. outMessageNameTextBox.Enabled = false;
  1752. outMessageNameTextBox.Text = outMessage.Name;
  1753. outMessageNameTextBox.Anchor = AnchorStyles.Left | AnchorStyles.Top |
  1754. AnchorStyles.Right;
  1755. outMessageParamsCombo = new ComboBox();
  1756. outMessageParamsCombo.DropDownStyle = ComboBoxStyle.DropDownList;
  1757. outMessageParamsCombo.Location = new Point(65, 5);
  1758. outMessageParamsCombo.Name = "outMessageParamsCombo" + opIndex;
  1759. outMessageParamsCombo.Size = new Size(80, 21);
  1760. outMessageParamsCombo.Anchor = AnchorStyles.Left | AnchorStyles.Top |
  1761. AnchorStyles.Right;
  1762. // Fill the combo box with the Message values.
  1763. foreach (SchemaElement element in serviceInterfaceContract.MessageSchemas)
  1764. {
  1765. outMessageParamsCombo.Items.Add(element.ElementName);
  1766. }
  1767. outMessageParamsCombo.SelectedIndex = 0;
  1768. return outDocTextBox;
  1769. }
  1770. private Label CreateOutDocLabel(int opIndex)
  1771. {
  1772. Label outDocLabel = new Label();
  1773. outDocLabel.Location = new Point(8, 149);
  1774. outDocLabel.Name = "outDocLabel" + opIndex;
  1775. outDocLabel.Size = new Size(88, 23);
  1776. outDocLabel.Text = "Documentation:";
  1777. return outDocLabel;
  1778. }
  1779. private CheckBox CreateOutMessageHeaderCheckBox(int opIndex)
  1780. {
  1781. CheckBox outMessageHeaderCheckBox = new CheckBox();
  1782. outMessageHeaderCheckBox.Location = new Point(9, 95);
  1783. outMessageHeaderCheckBox.Name = "outMessageHeaderCheckBox" + opIndex;
  1784. outMessageHeaderCheckBox.Text = "Message headers (optional)";
  1785. outMessageHeaderCheckBox.Size = new Size(181, 25);
  1786. return outMessageHeaderCheckBox;
  1787. }
  1788. private ComboBox CreateOutMessageHeaderCombo(int opIndex)
  1789. {
  1790. ComboBox outMessageHeaderCombo = new ComboBox();
  1791. outMessageHeaderCombo.DropDownStyle = ComboBoxStyle.DropDownList;
  1792. outMessageHeaderCombo.Location = new Point(8, 120);
  1793. outMessageHeaderCombo.Enabled = false;
  1794. outMessageHeaderCombo.Name = "outMessageHeaderCombo" + opIndex;
  1795. outMessageHeaderCombo.Size = new Size(100, 21);
  1796. outMessageHeaderCombo.Items.Add("<New...>");
  1797. outMessageHeaderCombo.SelectedIndex = 0;
  1798. outMessageHeaderCombo.Anchor = AnchorStyles.Left | AnchorStyles.Top |
  1799. AnchorStyles.Right;
  1800. return outMessageHeaderCombo;
  1801. }
  1802. private LinkLabel CreateOutRemoveHeaderLink(List<Message> addedOutHeaderMsgs)
  1803. {
  1804. LinkLabel outRemoveHeaderLink = new LinkLabel();
  1805. outRemoveHeaderLink.Text = "Remove";
  1806. outRemoveHeaderLink.Location = new Point(193, 95);
  1807. outRemoveHeaderLink.Size = new Size(64, 25);
  1808. outRemoveHeaderLink.TextAlign = ContentAlignment.MiddleRight;
  1809. outRemoveHeaderLink.Visible = (addedOutHeaderMsgs != null);
  1810. return outRemoveHeaderLink;
  1811. }
  1812. #endregion
  1813. /// <summary>
  1814. /// Reads the XML comment from the resource file. Wizard places this XML comment on the top of the
  1815. /// WSDL file. XML comment is stored in the resource file with "RT_HEADER" key. Once the XML comment is
  1816. /// read, the procedure will replace the substring - @VERSION@ in it with application's current version
  1817. /// number.
  1818. /// </summary>
  1819. /// <returns>The formatted XML comment with the application's current version number.</returns>
  1820. private string GetXmlCommentForWSDL()
  1821. {
  1822. // Read the current application version.
  1823. Version ver = Assembly.GetExecutingAssembly().GetName().Version;
  1824. string version = ver.Major.ToString() + "." + ver.Minor.ToString() + "." +
  1825. ver.Build.ToString() + "." + ver.Revision.ToString();
  1826. // Get the XML comment and replace the @VERSION@ with the current version.
  1827. string comment = ResourceHelper.GetString(
  1828. "Thinktecture.Tools.Wscf.UI.WsdlWizard.Resources.AssemblyResources",
  1829. System.Reflection.Assembly.GetExecutingAssembly(),
  1830. "RT_HEADER");
  1831. comment = comment.Replace("@VERSION@", version);
  1832. return comment;
  1833. }
  1834. /// <summary>
  1835. /// Updates the current folder, every time the schemaLocation is set.
  1836. /// </summary>
  1837. private void UpdateCurrentFolder(string location)
  1838. {
  1839. int lastBackSlash = location.LastIndexOf("\\");
  1840. if(lastBackSlash > 0)
  1841. {
  1842. this.currentFolder = location.Substring(0, lastBackSlash + 1);
  1843. }
  1844. else
  1845. {
  1846. this.currentFolder = location;
  1847. }
  1848. }
  1849. #region "Existing WSDL - Load into wizard pages"
  1850. /// <summary>
  1851. /// Imports the basic metadata to UI controls from an existing WSDL <see cref="InterfaceContract"/>.
  1852. /// </summary>
  1853. private void ImportBasicServiceMetaData()
  1854. {
  1855. if(importedContract != null)
  1856. {
  1857. tbServiceName.Text = importedContract.ServiceName;
  1858. tbNamespace.Text = importedContract.ServiceNamespace;
  1859. tbServiceDoc.Text = importedContract.ServiceDocumentation;
  1860. }
  1861. }
  1862. /// <summary>
  1863. /// Imports the imported schema files to UI from an existing WSDL <see cref="InterfaceContract"/>.
  1864. /// </summary>
  1865. private bool ImportSchemaImports()
  1866. {
  1867. importsListView.Items.Clear();
  1868. foreach(SchemaImport import in importedContract.Imports)
  1869. {
  1870. string fname = string.Empty;
  1871. ListViewItem importItem = new ListViewItem();
  1872. // Check whether the file is a reference to an URI.
  1873. if(import.SchemaLocation.ToLower().StartsWith("http://"))
  1874. {
  1875. // Obtain the file from the web and save it in the project folder. Then map that
  1876. // file name in the WSDL.
  1877. WebRequest req = WebRequest.Create(import.SchemaLocation);
  1878. WebResponse result = null;
  1879. try
  1880. {
  1881. result = req.GetResponse();
  1882. }
  1883. catch
  1884. {
  1885. MessageBox.Show("Could not import the XSD file(s) from the specified URI.",
  1886. "WSDL Wizard", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  1887. return false;
  1888. }
  1889. fname = import.SchemaLocation.Substring(
  1890. import.SchemaLocation.LastIndexOf("/") + 1);
  1891. importItem.Text = fname;
  1892. importItem.SubItems.Add(import.SchemaLocation);
  1893. }
  1894. else if(import.SchemaLocation.LastIndexOf('\\') > -1)
  1895. {
  1896. fname = import.SchemaLocation.Substring(
  1897. import.SchemaLocation.LastIndexOf("\\") + 1);
  1898. importItem.Text = fname;
  1899. importItem.SubItems.Add(import.SchemaLocation);
  1900. }
  1901. else
  1902. {
  1903. string fqName = "";
  1904. fqName = import.SchemaLocation;
  1905. if(fqName.StartsWith("../"))
  1906. {
  1907. fqName = IOPathHelper.GetAbsolutePath(fqName, this.wsdlLocation, this.projectRootDirectory);
  1908. }
  1909. else
  1910. {
  1911. fqName = IOPathHelper.GetAbsolutePath(fqName, this.wsdlLocation, this.projectRootDirectory);
  1912. }
  1913. fname = fqName.Substring(fqName.LastIndexOf("\\") + 1);
  1914. if(File.Exists(fqName))
  1915. {
  1916. importItem.Text = fname;
  1917. importItem.SubItems.Add(fqName);
  1918. }
  1919. else
  1920. {
  1921. MessageBox.Show("Could not locate the XSD file(s) imported to this WSDL",
  1922. "WSDL Wizard", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  1923. return false;
  1924. }
  1925. }
  1926. importsListView.Items.Add(importItem);
  1927. }
  1928. return true;
  1929. }
  1930. /// <summary>
  1931. /// Imports the service operations to UI from an existing WSDL <see cref="InterfaceContract"/>.
  1932. /// </summary>
  1933. private void ImportOperations()
  1934. {
  1935. if(importedContract != null)
  1936. {
  1937. operationsListView.Items.Clear();
  1938. foreach(Operation op in importedContract.Operations)
  1939. {
  1940. string mep = "Request/Response";
  1941. if(op.Mep == Mep.OneWay)
  1942. mep = "One-Way";
  1943. ListViewItem listViewItem1 =
  1944. new ListViewItem(new string[] {op.Name, mep, "", ""}, -1);
  1945. listViewItem1.Tag = op.Name;
  1946. operationsListView.Items.AddRange(
  1947. new ListViewItem[] {listViewItem1});
  1948. // Check whether the Op name is using the default naming pattern (i.e. OperationX) and
  1949. // increment the counter.
  1950. // TODO: We can use a regular expression here to check this.
  1951. if(op.Name.ToLower().StartsWith("operation"))
  1952. {
  1953. string tail = op.Name.Substring(9);
  1954. try
  1955. {
  1956. int.Parse(tail);
  1957. operationCount++;
  1958. }
  1959. catch(FormatException)
  1960. {
  1961. }
  1962. }
  1963. }
  1964. }
  1965. }
  1966. /// <summary>
  1967. /// Imports the additional options from an existing WSDL <see cref="InterfaceContract"/>.
  1968. /// </summary>
  1969. private void ImportAdditionalOptions()
  1970. {
  1971. if(importedContract != null)
  1972. {
  1973. this.cbNeedsServiceElement.Checked = importedContract.NeedsServiceElement;
  1974. cbSoap12.Checked = (importedContract.Bindings & InterfaceContract.SoapBindings.Soap12) == InterfaceContract.SoapBindings.Soap12;
  1975. }
  1976. }
  1977. /// <summary>
  1978. /// Imports the embedded types in the WSDL.
  1979. /// </summary>
  1980. private void ImportEmbeddedTypes()
  1981. {
  1982. if(importedContract != null)
  1983. {
  1984. //TODO:(SB): Check the usage of this method
  1985. //this.messageSchemas.AddRange(importedContract.Types);
  1986. //this.headerSchemas.AddRange(importedContract.Types);
  1987. }
  1988. }
  1989. #endregion
  1990. #region "common methods for new WSDL and existing WSDL"
  1991. // used to load the operation panes
  1992. /// <summary>
  1993. /// Imports the message parameters for a specified operation from an existing WSDL.
  1994. /// <see cref="InterfaceContract"/>.
  1995. /// </summary>
  1996. /// <param name="op">The <see cref="Operation"/> to import the message parameters in to.</param>
  1997. /// <param name="output">Indicates whether the current message is input or output.</param>
  1998. /// <param name="parametersCombo">Reference to the combo box which contains the message parameters.</param>
  1999. /// <param name="chkName">Reference to the check box, which indicates whether the customized message name is selected or not.</param>
  2000. /// <param name="tbName">Reference to the text box which contains the customized message name. </param>
  2001. /// <param name="messageLabel">Reference to the Property Pane which contains the message name.</param>
  2002. /// <param name="opDocumentation">Reference to the text box which contains the <see cref="Operation"/>'s documentation.</param>
  2003. /// <param name="msgDocumentation">Reference to the text box which contains the <see cref="Message"/>'s documentation.</param>
  2004. /// <param name="originalOperationName">String which contains the original name of the operation. User can always change the operation name after infering operations or while round-tripping. This parameter contains the name of the operation before any of those alternations.</param>
  2005. private void ImportMessageParameter(Operation op, bool output, ComboBox parametersCombo,
  2006. CheckBox chkName, TextBox tbName, PropertyPane messageLabel, TextBox opDocumentation,
  2007. TextBox msgDocumentation, string originalOperationName)
  2008. {
  2009. if (oldOperations.Count > 0)
  2010. {
  2011. if (ImportMessageParameter(oldOperations, op, output,
  2012. parametersCombo, chkName, tbName, messageLabel,
  2013. opDocumentation, msgDocumentation, originalOperationName))
  2014. {
  2015. return;
  2016. }
  2017. }
  2018. if (importedContract != null)
  2019. {
  2020. if (ImportMessageParameter(importedContract.Operations, op, output,
  2021. parametersCombo, chkName, tbName, messageLabel, opDocumentation, msgDocumentation,
  2022. originalOperationName))
  2023. {
  2024. return;
  2025. }
  2026. }
  2027. if (serviceInterfaceContract.Operations.Count > 0)
  2028. {
  2029. if (ImportMessageParameter(serviceInterfaceContract.Operations, op, output,
  2030. parametersCombo, chkName, tbName, messageLabel,
  2031. opDocumentation, msgDocumentation, originalOperationName))
  2032. {
  2033. return;
  2034. }
  2035. }
  2036. }
  2037. /// <summary>
  2038. /// Imports the message parameters for a specified operation from an existing WSDL.
  2039. /// </summary>
  2040. /// <param name="operations">Collection of operations to import the message parameters from.</param>
  2041. /// <param name="op">The <see cref="Operation"/> to import the message parameters in to.</param>
  2042. /// <param name="output">Indicates whether the current message is input or output.</param>
  2043. /// <param name="parametersCombo">Reference to the combo box which contains the message parameters.</param>
  2044. /// <param name="chkName">Reference to the check box, which indicates whether the customized message name is selected or not.</param>
  2045. /// <param name="tbName">Reference to the text box which contains the customized message name. </param>
  2046. /// <param name="messageLabel">Reference to the Property Pane which contains the message name.</param>
  2047. /// <param name="opDocumentation">Reference to the text box which contains the <see cref="Operation"/>'s documentation.</param>
  2048. /// <param name="msgDocumentation">Reference to the text box which contains the <see cref="Message"/>'s documentation.</param>
  2049. /// <returns>A boolean indicating whether any message parameter is imported or not.</returns>
  2050. /// <param name="originalOperationName">String which contains the original name of the operation. User can always change the operation name after infering operations or while round-tripping. This parameter contains the name of the operation before any of those alternations.</param>
  2051. private bool ImportMessageParameter(IEnumerable<Operation> operations, Operation op, bool output,
  2052. ComboBox parametersCombo, CheckBox chkName, TextBox tbName, PropertyPane messageLabel,
  2053. TextBox opDocumentation, TextBox msgDocumentation, string originalOperationName)
  2054. {
  2055. foreach (Operation importedOp in operations)
  2056. {
  2057. if (importedOp.Name == op.Name || (originalOperationName != "" && importedOp.Name == originalOperationName))
  2058. {
  2059. // Identify the message from the message collection.
  2060. Message importedMsg = null;
  2061. Message msg = null;
  2062. if (!output)
  2063. {
  2064. importedMsg = importedOp.Input;
  2065. msg = op.Input;
  2066. }
  2067. else
  2068. {
  2069. importedMsg = importedOp.Output;
  2070. msg = op.Output;
  2071. }
  2072. if (importedMsg != null)
  2073. {
  2074. // Set the new message parameters.
  2075. int index = 0;
  2076. foreach (SchemaElement element in serviceInterfaceContract.MessageSchemas)
  2077. {
  2078. if (importedMsg.Element == element)
  2079. {
  2080. msg.Element = element;
  2081. parametersCombo.SelectedIndex = index;
  2082. break;
  2083. }
  2084. index++;
  2085. }
  2086. // Enable the custom name text box and put the custom message name in.
  2087. if (importedOp.Name == op.Name && msg.Name != importedMsg.Name)
  2088. {
  2089. tbName.Enabled = true;
  2090. tbName.Text = importedMsg.Name;
  2091. msg.Name = importedMsg.Name;
  2092. messageLabel.Text = importedMsg.Name;
  2093. chkName.Checked = true;
  2094. }
  2095. // Set the Message documentation.
  2096. msg.Documentation = importedMsg.Documentation;
  2097. msgDocumentation.Text = importedMsg.Documentation;
  2098. }
  2099. // Set the operation documentation.
  2100. op.Documentation = importedOp.Documentation;
  2101. opDocumentation.Text = importedOp.Documentation;
  2102. return true;
  2103. }
  2104. }
  2105. return false;
  2106. }
  2107. /// <summary>
  2108. /// Imports the message headers for a specified message from an existing WSDL.
  2109. /// <see cref="InterfaceContract"/>.
  2110. /// </summary>
  2111. /// <param name="op">Reference to the <see cref="Operation"/>, <see cref="Message"/> msg belongs to.</param>
  2112. /// <param name="msg">Reference to the <see cref="Message"/>, headers belong to.</param>
  2113. /// <param name="headersCombo">Reference to the combo box which contains the headers.</param>
  2114. /// <param name="hasHeaders">Reference to the check box which indicates whether the custom headers are added or not.</param>
  2115. /// <param name="outMessage">Indicates whether the current message is input or output.</param>
  2116. /// <returns>A list of messages with the added header messages.</returns>
  2117. private List<Message> ImportMessageHeaders(Operation op, Message msg,
  2118. ComboBox headersCombo, CheckBox hasHeaders, bool outMessage)
  2119. {
  2120. // Read the message headers from the old operations collection if available.
  2121. List<Message> addedHeaderMessages = null;
  2122. if (oldOperations.Count > 0)
  2123. {
  2124. addedHeaderMessages =
  2125. ImportMessageHeaders(oldOperations, op, msg, headersCombo,
  2126. hasHeaders, outMessage);
  2127. if (addedHeaderMessages != null)
  2128. {
  2129. return addedHeaderMessages;
  2130. }
  2131. }
  2132. else
  2133. {
  2134. // Read the message headers from the imported contract.
  2135. if (importedContract != null)
  2136. {
  2137. addedHeaderMessages =
  2138. ImportMessageHeaders(importedContract.Operations, op, msg, headersCombo,
  2139. hasHeaders, outMessage);
  2140. if (addedHeaderMessages != null)
  2141. {
  2142. return addedHeaderMessages;
  2143. }
  2144. }
  2145. }
  2146. return addedHeaderMessages;
  2147. }
  2148. /// <summary>
  2149. /// Imports the message headers for a specified message from an existing WSDL.
  2150. /// <see cref="InterfaceContract"/>.
  2151. /// </summary>
  2152. /// <param name="ops">Reference to the <see cref="OperationsCollection"/> to search for the <see cref="Operation"/>, which <see cref="Message"/> msg belongs to.</param>
  2153. /// <param name="op">Reference to the <see cref="Operation"/>, <see cref="Message"/> msg belongs to.</param>
  2154. /// <param name="msg">Reference to the <see cref="Message"/>, headers belong to.</param>
  2155. /// <param name="headersCombo">Reference to the combo box which contains the headers.</param>
  2156. /// <param name="hasHeaders">Reference to the check box which indicates whether the custom headers are added or not.</param>
  2157. /// <param name="outMessage">Indicates whether the current message is input or output.</param>
  2158. /// <returns>A list of messages with the added header messages.</returns>
  2159. private List<Message> ImportMessageHeaders(List<Operation> ops, Operation op,
  2160. Message msg, ComboBox headersCombo, CheckBox hasHeaders, bool outMessage)
  2161. {
  2162. List<Message> addedHeaderMessages = null;
  2163. foreach (Operation importedOp in ops)
  2164. {
  2165. if (importedOp.Name == op.Name)
  2166. {
  2167. Message importedMsg = null;
  2168. if (!outMessage)
  2169. {
  2170. importedMsg = importedOp.Input;
  2171. }
  2172. else
  2173. {
  2174. importedMsg = importedOp.Output;
  2175. }
  2176. // Check for the headers.
  2177. if (importedMsg != null && importedMsg.HeadersCollection.Count > 0)
  2178. {
  2179. addedHeaderMessages = new List<Message>();
  2180. hasHeaders.Checked = true; // Enable headers check box.
  2181. headersCombo.Enabled = true; // Enable the headers combo box.
  2182. // Add the headers to current message's headers collection.
  2183. foreach (MessageHeader header in importedMsg.HeadersCollection)
  2184. {
  2185. // Find and add the header message to the operation.
  2186. foreach (Message headerMsg in importedOp.MessagesCollection)
  2187. {
  2188. if (headerMsg.Name == header.Message)
  2189. {
  2190. msg.HeadersCollection.Add(header);
  2191. op.MessagesCollection.Add(headerMsg);
  2192. addedHeaderMessages.Add(headerMsg);
  2193. // Finally add the header details to the combo box.
  2194. headersCombo.Items.Insert(headersCombo.Items.Count - 1,
  2195. headerMsg.Element.ElementName);
  2196. }
  2197. }
  2198. }
  2199. break;
  2200. }
  2201. }
  2202. }
  2203. return addedHeaderMessages;
  2204. }
  2205. #endregion
  2206. #endregion
  2207. protected override void WndProc(ref System.Windows.Forms.Message m)
  2208. {
  2209. const int WM_PAINT = 0xf;
  2210. switch (m.Msg)
  2211. {
  2212. case WM_PAINT:
  2213. importsListView.Columns[1].Width = -2;
  2214. operationsListView.Columns[1].Width = -2;
  2215. xsdpathsListView.Columns[1].Width = -2;
  2216. break;
  2217. }
  2218. base.WndProc(ref m);
  2219. }
  2220. #region MesssagePaneLabelController
  2221. /// <summary>
  2222. /// Represents a custom controller for the dynamically created PropertyPane and Textbox controls.
  2223. /// </summary>
  2224. private class MessagePaneLabelController
  2225. {
  2226. #region Private fields
  2227. private TextBox currentTextBox;
  2228. private PropertyPane currentLabel;
  2229. #endregion
  2230. #region Constructors
  2231. /// <summary>
  2232. /// Initializes a new instance of the MessagePaneLabelController with the specified values.
  2233. /// </summary>
  2234. /// <param name="messageTextBox">Reference to the Textbox to control.</param>
  2235. /// <param name="messageLabel">Reference to the PropertyPane to control.</param>
  2236. public MessagePaneLabelController(TextBox messageTextBox,
  2237. PropertyPane messageLabel)
  2238. {
  2239. currentTextBox = messageTextBox;
  2240. currentLabel = messageLabel;
  2241. // Attach the event handler for the current text box's lost focus event.
  2242. currentTextBox.LostFocus += new EventHandler(TextBox_FocusOver);
  2243. }
  2244. #endregion
  2245. #region Event handlers
  2246. /// <summary>
  2247. /// Performs the actions when the controlled text box changes the focus.
  2248. /// </summary>
  2249. /// <param name="sender">The source of the event.</param>
  2250. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  2251. private void TextBox_FocusOver(object sender, EventArgs e)
  2252. {
  2253. currentLabel.Text = currentTextBox.Text;
  2254. PropertyPane propPane = (PropertyPane)currentTextBox.Parent;
  2255. PropertyTree propTree = ((PropertyTree)currentLabel.Parent);
  2256. propTree.SelectedPaneNode = propPane.PaneNode;
  2257. }
  2258. #endregion
  2259. }
  2260. #endregion
  2261. #region MessageNameTextBoxController
  2262. /// <summary>
  2263. /// Represents a custom controller for dynamically created control for the custom message name.
  2264. /// </summary>
  2265. private class MessageNameTextBoxController
  2266. {
  2267. #region Private fields
  2268. private TextBox currentTextBox;
  2269. private CheckBox currentCheckBox;
  2270. private PropertyPane currentMessageLabel;
  2271. private string initialName;
  2272. private Message message;
  2273. #endregion
  2274. #region Constructors
  2275. /// <summary>
  2276. /// Initializes a new instance of MessageNameTextBoxController class with the specified values.
  2277. /// </summary>
  2278. /// <param name="messageNameTextBox">Reference to the text box which contains the message name.</param>
  2279. /// <param name="messageNameCheckBox">Reference to the check box which indicates whether the customized message name is used or not.</param>
  2280. /// <param name="message">Reference to the current <see cref="Message"/>.</param>
  2281. /// <param name="messageLabel">Reference to the tree view node which displays the message name.</param>
  2282. public MessageNameTextBoxController(TextBox messageNameTextBox,
  2283. CheckBox messageNameCheckBox, Message message,
  2284. PropertyPane messageLabel)
  2285. {
  2286. currentTextBox = messageNameTextBox;
  2287. currentCheckBox = messageNameCheckBox;
  2288. currentMessageLabel = messageLabel;
  2289. initialName = currentTextBox.Text;
  2290. this.message = message;
  2291. // Attach the event handlers for the controls.
  2292. currentCheckBox.CheckedChanged += new EventHandler(CheckBox_CheckedChanged);
  2293. currentTextBox.TextChanged += new EventHandler(TextBox_TextChanged);
  2294. }
  2295. #endregion
  2296. #region Event handlers
  2297. /// <summary>
  2298. /// Performs the actions when the check box status is changed.
  2299. /// </summary>
  2300. /// <param name="sender">The source of the event.</param>
  2301. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  2302. /// <remarks>If the check box is unchecked this method will reset the message name to the initial name.</remarks>
  2303. private void CheckBox_CheckedChanged(object sender, EventArgs e)
  2304. {
  2305. if(currentTextBox.Enabled == false)
  2306. {
  2307. currentTextBox.Enabled = true;
  2308. }
  2309. else
  2310. {
  2311. // Reset the message name to the initial value.
  2312. currentTextBox.Enabled = false;
  2313. currentTextBox.Text = initialName;
  2314. message.Name = initialName;
  2315. currentMessageLabel.Text = initialName;
  2316. }
  2317. }
  2318. /// <summary>
  2319. /// Performs the actions when the content of the text box changes.
  2320. /// </summary>
  2321. /// <param name="sender">The source of the event.</param>
  2322. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  2323. /// <remarks>This method updates the current message's message name when updating the text box.</remarks>
  2324. private void TextBox_TextChanged(object sender, EventArgs e)
  2325. {
  2326. message.Name = currentTextBox.Text;
  2327. }
  2328. #endregion
  2329. }
  2330. #endregion
  2331. #region InHeaderComboBoxController
  2332. /// <summary>
  2333. /// Represents a custom controller for dynamically created controls
  2334. /// to hold header messages for input message.
  2335. /// </summary>
  2336. private class InHeaderComboBoxController
  2337. {
  2338. #region Private fields
  2339. private bool showDialog;
  2340. private ComboBox currentComboBox;
  2341. private CheckBox currentCheckBox;
  2342. private TextBox currentMessageNameTextBox;
  2343. private Operation currentOperation;
  2344. private Message currentMessage;
  2345. private MessageHeader currentHeader;
  2346. private Message headerMessage;
  2347. private List<SchemaElement> headerElements;
  2348. private List<Message> headerMessages;
  2349. private LinkLabel currentRemoveButton;
  2350. #endregion
  2351. #region Constructors
  2352. /// <summary>
  2353. /// Initializes a new instance of InHeaderComboBoxController class with specified values.
  2354. /// </summary>
  2355. /// <param name="headerComboBox">Reference to the combo box which contains the headers.</param>
  2356. /// <param name="headerCheckBox">Reference to the check box which indicates whether to use the message header(s) or not.</param>
  2357. /// <param name="messageNameTextBox">Reference to the text box which contains the customized message name.</param>
  2358. /// <param name="operation">Reference to the instance of <see cref="Operation"/> class, <see cref="MessageHeader"/> belongs to.</param>
  2359. /// <param name="message">Reference to the instance of <see cref="Message"/> class, <see cref="MessageHeader"/> belongs to.</param>
  2360. /// <param name="header">Reference to the current <see cref="MessageHeader"/> of the message.</param>
  2361. /// <param name="headerElements">
  2362. /// Reference to an instance of <see cref="SchemaElements"/> class with schema elements for headers.
  2363. /// </param>
  2364. /// <param name="removeButton">Reference to the link label control used to remove headers.</param>
  2365. /// <param name="addedMessages">Reference to an instance of <see cref="MessagesCollection"/> class with <see cref="Message"/> objects added for the header.</param>
  2366. public InHeaderComboBoxController(ComboBox headerComboBox,
  2367. CheckBox headerCheckBox,
  2368. TextBox messageNameTextBox,
  2369. Operation operation,
  2370. Message message,
  2371. MessageHeader header,
  2372. List<SchemaElement> headerElements,
  2373. LinkLabel removeButton,
  2374. IEnumerable<Message> addedMessages)
  2375. {
  2376. currentComboBox = headerComboBox;
  2377. currentCheckBox = headerCheckBox;
  2378. currentMessageNameTextBox = messageNameTextBox;
  2379. currentOperation = operation;
  2380. currentMessage = message;
  2381. currentHeader = header;
  2382. this.headerElements = headerElements;
  2383. this.headerMessages = new List<Message>();
  2384. if(addedMessages != null)
  2385. {
  2386. foreach(Message impHeader in addedMessages)
  2387. {
  2388. this.headerMessages.Add(impHeader);
  2389. }
  2390. }
  2391. this.currentRemoveButton = removeButton;
  2392. this.showDialog = true;
  2393. // Attach the event handlers.
  2394. currentCheckBox.CheckedChanged += new EventHandler(CheckBox_CheckedChanged);
  2395. currentComboBox.SelectedIndexChanged +=
  2396. new EventHandler(ComboBox_SelectedIndexChanged);
  2397. currentMessageNameTextBox.LostFocus += new EventHandler(TextBox_FocusOver);
  2398. currentRemoveButton.Click += new EventHandler(this.RemoveLink_Click);
  2399. }
  2400. #endregion
  2401. #region Event handlers
  2402. /// <summary>
  2403. /// Performs the actions when textbox focus changes.
  2404. /// </summary>
  2405. /// <param name="sender">The event source.</param>
  2406. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  2407. /// <remarks>When the content of the text box changes, this procedure updates the name of the
  2408. /// <see cref="MessageHeader"/> accordingly.</remarks>
  2409. private void TextBox_FocusOver(object sender, EventArgs e)
  2410. {
  2411. if (headerMessage != null) headerMessage.Name = currentMessageNameTextBox.Text + "Header";
  2412. if (currentHeader != null)
  2413. {
  2414. currentHeader.Message = currentMessageNameTextBox.Text + "Header";
  2415. }
  2416. }
  2417. /// <summary>
  2418. /// Performs the actions when the status of the checkbox control changes.
  2419. /// </summary>
  2420. /// <param name="sender">The event source.</param>
  2421. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  2422. /// <remarks>If the check box is checked, this method will enable the combo box which displays the
  2423. /// headers. Then it calls the <see cref="AddNewHeader"/> method to add a new header.
  2424. /// If the check box is unchecked this method will perform the following tasks.
  2425. /// 1. Removes the header messages from the <see cref="Operation"/>.
  2426. /// 2. Clears the HeadersCollection of the current <see cref="Message"/>.
  2427. /// 3. Removes the items from the combo box which displays the headers.
  2428. /// 4. Disables the combo box.
  2429. /// </remarks>
  2430. private void CheckBox_CheckedChanged(object sender, EventArgs e)
  2431. {
  2432. // Code for multiple headers support.
  2433. if(currentCheckBox.Checked)
  2434. {
  2435. currentComboBox.Enabled = true;
  2436. this.AddNewHeader();
  2437. }
  2438. else
  2439. {
  2440. // Remove the Header messages from the operation.
  2441. foreach(Message msg in this.headerMessages)
  2442. {
  2443. this.currentOperation.MessagesCollection.Remove(msg);
  2444. }
  2445. // Clear the headers for the current message.
  2446. this.currentMessage.HeadersCollection.Clear();
  2447. // Clear the headerMessages collection.
  2448. this.headerMessages.Clear();
  2449. // Remove the items on the combo box.
  2450. while(this.currentComboBox.Items.Count != 1)
  2451. {
  2452. this.currentComboBox.Items.RemoveAt(0);
  2453. }
  2454. // Finally disable the combo box.
  2455. showDialog = false;
  2456. currentComboBox.SelectedIndex = currentComboBox.Items.Count - 1;
  2457. currentComboBox.Enabled = false;
  2458. currentRemoveButton.Visible = false;
  2459. }
  2460. }
  2461. /// <summary>
  2462. /// Performs the actions when the selected index of the header messages combo box changes.
  2463. /// </summary>
  2464. /// <param name="sender">The event source.</param>
  2465. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  2466. /// <remarks>If the selected item is the last item of the list, the method will call the
  2467. /// <see cref="AddNewHeader"/> method. Otherwise it shows the remove button to remove the
  2468. /// selected header.</remarks>
  2469. private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
  2470. {
  2471. if(currentComboBox.SelectedIndex == currentComboBox.Items.Count - 1)
  2472. {
  2473. currentRemoveButton.Visible = false;
  2474. if(showDialog) AddNewHeader();
  2475. showDialog = true;
  2476. }
  2477. else
  2478. {
  2479. currentRemoveButton.Visible = true;
  2480. }
  2481. }
  2482. /// <summary>
  2483. /// Performs the actions when the remove link label is clicked.
  2484. /// </summary>
  2485. /// <param name="sender">The event source.</param>
  2486. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  2487. /// <remarks>This method removes the <see cref="MessageHeader"/> from the <see cref="Message"/>
  2488. /// and <see cref="Message"/> from the <see cref="Operation"/>. </remarks>
  2489. private void RemoveLink_Click(object sender, EventArgs e)
  2490. {
  2491. // Select the message from the added header messages collection.
  2492. Message msg = headerMessages[currentComboBox.SelectedIndex];
  2493. // Remove the message from the Operation.
  2494. currentOperation.MessagesCollection.Remove(msg);
  2495. // Remove the MessageHeader from the currentMessage.
  2496. currentMessage.HeadersCollection.RemoveAt(currentComboBox.SelectedIndex);
  2497. // Remove the message from the header messages collection.
  2498. headerMessages.RemoveAt(currentComboBox.SelectedIndex );
  2499. // Remove the header from the combo box.
  2500. currentComboBox.Items.RemoveAt(currentComboBox.SelectedIndex);
  2501. // Change the current index of the combo box.
  2502. SelectTheLatestHeader();
  2503. }
  2504. #endregion
  2505. #region Private methods
  2506. /// <summary>
  2507. /// Prompts a dialog box to select the new header. Once it is selected this method adds it to
  2508. /// <see cref="Message.HeadersCollection"/>. Also this method creates a new <see cref="Message"/>
  2509. /// for the header and puts it to the <see cref="Operation.MessagesCollection"/>.
  2510. /// </summary>
  2511. private void AddNewHeader()
  2512. {
  2513. SchemaElement newHeaderMessage = new SchemaElement();
  2514. // Display the dialog box.
  2515. SelectHeaderDialog dialog = new SelectHeaderDialog(this.headerElements, ref newHeaderMessage);
  2516. dialog.ShowDialog();
  2517. if(newHeaderMessage.ElementName != null)
  2518. {
  2519. // First check whether the header already exists. And remove it if it does.
  2520. foreach(Message msg in this.headerMessages)
  2521. {
  2522. if(newHeaderMessage.ElementName == msg.Element.ElementName &&
  2523. newHeaderMessage.ElementNamespace == msg.Element.ElementNamespace)
  2524. {
  2525. // Select the last item before returning.
  2526. SelectTheLatestHeader();
  2527. return; // Exit without adding.
  2528. }
  2529. }
  2530. string headerName = "";
  2531. int index = 1;
  2532. while(headerName == "")
  2533. {
  2534. headerName = currentMessage.Name + "Header" + index.ToString();
  2535. // Check whether we already have a header message with the same name.
  2536. foreach(MessageHeader hdr in currentMessage.HeadersCollection)
  2537. {
  2538. if(hdr.Name == headerName)
  2539. {
  2540. headerName = "";
  2541. index++;
  2542. break;
  2543. }
  2544. }
  2545. }
  2546. // Create the header message.
  2547. headerMessage = new Message();
  2548. headerMessage.Name = headerName;
  2549. headerMessage.Documentation = "";
  2550. headerMessage.Element.ElementName = newHeaderMessage.ElementName;
  2551. headerMessage.Element.ElementNamespace = newHeaderMessage.ElementNamespace;
  2552. // Create the header.
  2553. MessageHeader newHeader = new MessageHeader();
  2554. newHeader.Message = headerMessage.Name;
  2555. newHeader.Name = headerMessage.Name;
  2556. // Add header to the current message.
  2557. currentMessage.HeadersCollection.Add(newHeader);
  2558. // Add the new header message to the messages collection.
  2559. currentOperation.MessagesCollection.Add(headerMessage);
  2560. // Added the newly created header message to the header messages collection.
  2561. // Reason: In case we need to remove the header messages we need to distinguish
  2562. // them from the existing messages.
  2563. this.headerMessages.Add(headerMessage);
  2564. // Add the newly added header info to the headers combo box.
  2565. currentComboBox.Items.Insert
  2566. (currentComboBox.Items.Count - 1, headerMessage.Element.ElementName);
  2567. // Set the last selected header message as the default header.
  2568. currentComboBox.SelectedIndex = currentComboBox.Items.Count - 2;
  2569. }
  2570. }
  2571. /// <summary>
  2572. /// Sets the last item on the headers combo box as the default/selected item.
  2573. /// </summary>
  2574. private void SelectTheLatestHeader()
  2575. {
  2576. if(currentComboBox.Items.Count >= 2)
  2577. {
  2578. currentComboBox.SelectedIndex = currentComboBox.Items.Count - 2;
  2579. }
  2580. else
  2581. {
  2582. showDialog = false;
  2583. currentComboBox.SelectedIndex = currentComboBox.Items.Count - 1;
  2584. }
  2585. }
  2586. #endregion
  2587. }
  2588. #endregion
  2589. #region OutHeaderComboBoxController
  2590. /// <summary>
  2591. /// Represents a custom controller for dynamically created controls
  2592. /// to hold header messages for output message.
  2593. /// </summary>
  2594. private class OutHeaderComboBoxController
  2595. {
  2596. #region Private fields
  2597. private bool showDialog;
  2598. private ComboBox currentComboBox;
  2599. private CheckBox currentCheckBox;
  2600. private TextBox currentMessageNameTextBox;
  2601. private Operation currentOperation;
  2602. private Message currentMessage;
  2603. private MessageHeader currentHeader;
  2604. private Message headerMessage;
  2605. private List<SchemaElement> headerElements;
  2606. private List<Message> headerMessages;
  2607. private LinkLabel currentRemoveButton;
  2608. #endregion
  2609. #region Constructors
  2610. /// <summary>
  2611. /// Initializes a new instance of OutHeaderComboBoxController class with specified values.
  2612. /// </summary>
  2613. /// <param name="headerComboBox">Reference to the combo box which contains the headers.</param>
  2614. /// <param name="headerCheckBox">Reference to the check box which indicates whether to use the message header(s) or not.</param>
  2615. /// <param name="messageNameTextBox">Reference to the text box which contains the customized message name.</param>
  2616. /// <param name="operation">Reference to the instance of <see cref="Operation"/> class, <see cref="MessageHeader"/> belongs to.</param>
  2617. /// <param name="message">Reference to the instance of <see cref="Message"/> class, <see cref="MessageHeader"/> belongs to.</param>
  2618. /// <param name="header">Reference to the current <see cref="MessageHeader"/> of the message.</param>
  2619. /// <param name="headerElements">Reference to an instance of <see cref="SchemaElements"/> class with schema elements for headers.</param>
  2620. /// <param name="removeButton">Reference to the link label control used to remove headers.</param>
  2621. /// <param name="addedMessages">Reference to an instance of <see cref="MessagesCollection"/> class with <see cref="Message"/> objects added for the header.</param>
  2622. public OutHeaderComboBoxController(ComboBox headerComboBox,
  2623. CheckBox headerCheckBox,
  2624. TextBox messageNameTextBox,
  2625. Operation operation,
  2626. Message message,
  2627. MessageHeader header,
  2628. List<SchemaElement> headerElements,
  2629. LinkLabel removeButton,
  2630. IEnumerable<Message> addedMessages)
  2631. {
  2632. currentComboBox = headerComboBox;
  2633. currentCheckBox = headerCheckBox;
  2634. currentMessageNameTextBox = messageNameTextBox;
  2635. currentOperation = operation;
  2636. currentMessage = message;
  2637. currentHeader = header;
  2638. this.headerElements = headerElements;
  2639. this.headerMessages = new List<Message>();
  2640. if(addedMessages != null)
  2641. {
  2642. foreach(Message impHeader in addedMessages)
  2643. {
  2644. this.headerMessages.Add(impHeader);
  2645. }
  2646. }
  2647. this.currentRemoveButton = removeButton;
  2648. this.showDialog = true;
  2649. // Attach the event handlers.
  2650. currentCheckBox.CheckedChanged += new EventHandler(CheckBox_CheckedChanged);
  2651. currentComboBox.SelectedIndexChanged +=
  2652. new EventHandler(ComboBox_SelectedIndexChanged);
  2653. currentMessageNameTextBox.LostFocus += new EventHandler(TextBox_FocusOver);
  2654. currentRemoveButton.Click += new EventHandler(this.RemoveLink_Click);
  2655. }
  2656. #endregion
  2657. #region Event handlers
  2658. /// <summary>
  2659. /// Performs the actions when text box focus changes.
  2660. /// </summary>
  2661. /// <param name="sender">The event source.</param>
  2662. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  2663. /// <remarks>When the content of the text box changes, this procedure adjusts the name of the
  2664. /// header message accordingly.</remarks>
  2665. private void TextBox_FocusOver(object sender, EventArgs e)
  2666. {
  2667. if (headerMessage != null) headerMessage.Name = currentMessageNameTextBox.Text + "Header";
  2668. if (currentHeader != null)
  2669. {
  2670. currentHeader.Message = currentMessageNameTextBox.Text + "Header";
  2671. }
  2672. }
  2673. /// <summary>
  2674. /// Performs the actions when the status of the check box control changes.
  2675. /// </summary>
  2676. /// <param name="sender">The event source.</param>
  2677. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  2678. /// <remarks>If the check box is checked, this method will enable the combo box which displays the
  2679. /// headers. Then it calls the <see cref="AddNewHeader"/> method to add a new header.
  2680. /// If the check box is unchecked this method will perform the following tasks.
  2681. /// 1. Removes the header messages from the <see cref="Operation"/>.
  2682. /// 2. Clears the HeadersCollection of the current <see cref="Message"/>.
  2683. /// 3. Removes the items from the combo box which displays the headers.
  2684. /// 4. Disables the combo box.
  2685. /// </remarks>
  2686. private void CheckBox_CheckedChanged(object sender, EventArgs e)
  2687. {
  2688. if(currentCheckBox.Checked)
  2689. {
  2690. currentComboBox.Enabled = true;
  2691. this.AddNewHeader();
  2692. }
  2693. else
  2694. {
  2695. // Remove the Header messages from the operation
  2696. foreach(Message msg in this.headerMessages)
  2697. {
  2698. this.currentOperation.MessagesCollection.Remove(msg);
  2699. }
  2700. // Clear the headers for the current message.
  2701. this.currentMessage.HeadersCollection.Clear();
  2702. // Clear the header messages collection.
  2703. this.headerMessages.Clear();
  2704. // Remove the items on the combo box.
  2705. while(this.currentComboBox.Items.Count != 1)
  2706. {
  2707. this.currentComboBox.Items.RemoveAt(0);
  2708. }
  2709. // Finally disable the combo box.
  2710. showDialog = false;
  2711. currentComboBox.SelectedIndex = currentComboBox.Items.Count - 1;
  2712. currentComboBox.Enabled = false;
  2713. currentRemoveButton.Visible = false;
  2714. }
  2715. }
  2716. /// <summary>
  2717. /// Performs the actions when the selected index of the header messages combo box changes.
  2718. /// </summary>
  2719. /// <param name="sender">The event source.</param>
  2720. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  2721. /// <remarks>If the selected item is the last item of the list, the method will call the
  2722. /// <see cref="AddNewHeader"/> method. Otherwise it shows the remove button to remove the
  2723. /// selected header.</remarks>
  2724. private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
  2725. {
  2726. if(currentComboBox.SelectedIndex == currentComboBox.Items.Count - 1)
  2727. {
  2728. currentRemoveButton.Visible = false;
  2729. if(showDialog) AddNewHeader();
  2730. showDialog = true;
  2731. }
  2732. else
  2733. {
  2734. currentRemoveButton.Visible = true;
  2735. }
  2736. }
  2737. /// <summary>
  2738. /// Performs the actions when the remove link label is clicked.
  2739. /// </summary>
  2740. /// <param name="sender">The event source.</param>
  2741. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  2742. /// <remarks>This method removes the <see cref="MessageHeader"/> from the <see cref="Message"/>
  2743. /// and <see cref="Message"/> from the <see cref="Operation"/>. </remarks>
  2744. private void RemoveLink_Click(object sender, EventArgs e)
  2745. {
  2746. // Remove the header message.
  2747. Message msg = headerMessages[currentComboBox.SelectedIndex];
  2748. currentOperation.MessagesCollection.Remove(msg);
  2749. currentMessage.HeadersCollection.RemoveAt(currentComboBox.SelectedIndex);
  2750. headerMessages.RemoveAt(currentComboBox.SelectedIndex);
  2751. currentComboBox.Items.RemoveAt(currentComboBox.SelectedIndex);
  2752. // Change the current index of the combo box.
  2753. SelectTheLatestHeader();
  2754. }
  2755. #endregion
  2756. #region Private methods
  2757. /// <summary>
  2758. /// Prompts a dialog box to select the new header. Once it is selected this method adds it to
  2759. /// <see cref="Message.HeadersCollection"/>. Also this method creates a new <see cref="Message"/>
  2760. /// for the header and puts it to the <see cref="Operation.MessagesCollection"/>.
  2761. /// </summary>
  2762. private void AddNewHeader()
  2763. {
  2764. SchemaElement newHeaderMessage = new SchemaElement();
  2765. SelectHeaderDialog dialog = new SelectHeaderDialog(this.headerElements, ref newHeaderMessage);
  2766. dialog.ShowDialog();
  2767. if(newHeaderMessage.ElementName != null)
  2768. {
  2769. // First check whether the header already exists. And remove it if it does.
  2770. foreach(Message msg in this.headerMessages)
  2771. {
  2772. if(newHeaderMessage.ElementName == msg.Element.ElementName &&
  2773. newHeaderMessage.ElementNamespace == msg.Element.ElementNamespace)
  2774. {
  2775. // Set the last item before returning.
  2776. SelectTheLatestHeader();
  2777. return; // Exit without adding.
  2778. }
  2779. }
  2780. string headerName = "";
  2781. int index = 1;
  2782. while(headerName == "")
  2783. {
  2784. headerName = currentMessage.Name + "Header" + index.ToString();
  2785. foreach(MessageHeader hdr in currentMessage.HeadersCollection)
  2786. {
  2787. if(hdr.Name == headerName)
  2788. {
  2789. headerName = "";
  2790. index++;
  2791. break;
  2792. }
  2793. }
  2794. }
  2795. // Create the header message.
  2796. headerMessage = new Message();
  2797. headerMessage.Name = headerName; // currentMessage.Name + "Header" + headerNo;
  2798. headerMessage.Documentation = "";
  2799. headerMessage.Element.ElementName = newHeaderMessage.ElementName;
  2800. headerMessage.Element.ElementNamespace = newHeaderMessage.ElementNamespace;
  2801. // Create the header.
  2802. MessageHeader newHeader = new MessageHeader();
  2803. newHeader.Message = headerMessage.Name;
  2804. newHeader.Name = headerMessage.Name;
  2805. // Add header to the current message.
  2806. currentMessage.HeadersCollection.Add(newHeader);
  2807. // Add the new header message to the messages collection.
  2808. currentOperation.MessagesCollection.Add(headerMessage);
  2809. // Added the newly created header message to the header messages collection.
  2810. // Reason: In case we need to remove the header messages we need to distinguish
  2811. // them from the existing messages.
  2812. this.headerMessages.Add(headerMessage);
  2813. // Add the newly added header info to the headers combo box.
  2814. currentComboBox.Items.Insert(currentComboBox.Items.Count - 1,
  2815. headerMessage.Element.ElementName);
  2816. // Set the last selected header message as the default header.
  2817. currentComboBox.SelectedIndex = currentComboBox.Items.Count - 2;
  2818. }
  2819. }
  2820. /// <summary>
  2821. /// Sets the last item on the headers combo box as the default/selected item.
  2822. /// </summary>
  2823. private void SelectTheLatestHeader()
  2824. {
  2825. if(currentComboBox.Items.Count >= 2)
  2826. {
  2827. currentComboBox.SelectedIndex = currentComboBox.Items.Count - 2;
  2828. }
  2829. else
  2830. {
  2831. showDialog = false;
  2832. currentComboBox.SelectedIndex = currentComboBox.Items.Count - 1;
  2833. }
  2834. }
  2835. #endregion
  2836. }
  2837. #endregion
  2838. #region MessageDocumentationTextBoxController
  2839. /// <summary>
  2840. /// Represents a custom controller to handle the dynamically created text box which contains the <see cref="Message"/> documentation.
  2841. /// </summary>
  2842. private class MessageDocumentationTextBoxController
  2843. {
  2844. #region Private fields
  2845. private TextBox currentTextBox;
  2846. private Message message;
  2847. #endregion
  2848. #region Constructors
  2849. /// <summary>
  2850. /// Initializes a new instance of MessageDocumentationTextBoxController class with specified values.
  2851. /// </summary>
  2852. /// <param name="documentationTextBox">Reference to the text box control which contains the documentation.</param>
  2853. /// <param name="message">Reference to an instance of <see cref="Message"/> class which belongs the documentation.</param>
  2854. public MessageDocumentationTextBoxController(TextBox documentationTextBox, Message message)
  2855. {
  2856. this.currentTextBox = documentationTextBox;
  2857. this.message = message;
  2858. // Attach the event handlers.
  2859. currentTextBox.TextChanged += new EventHandler(TextBox_TextChanged);
  2860. }
  2861. #endregion
  2862. #region Event handlers
  2863. /// <summary>
  2864. /// Performs the actions when the text box content changes.
  2865. /// </summary>
  2866. /// <param name="sender">The event source.</param>
  2867. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  2868. /// <remarks>This method updates the <see cref="Message"/> object's documentation property.</remarks>
  2869. private void TextBox_TextChanged(object sender, EventArgs e)
  2870. {
  2871. this.message.Documentation = currentTextBox.Text;
  2872. }
  2873. #endregion
  2874. }
  2875. #endregion
  2876. #region OperationDocumentationTextBoxController
  2877. /// <summary>
  2878. /// Represents a custom controller to handle the dynamically created text box which contains the <see cref="Operation"/> documentation.
  2879. /// </summary>
  2880. private class OperationDocumentationTextBoxController
  2881. {
  2882. #region Private fields
  2883. private TextBox currentTextBox;
  2884. private Operation operation;
  2885. #endregion
  2886. #region Constructors
  2887. /// <summary>
  2888. /// Initializes a new instance of OperationDocumentationTextBoxController class with specified values.
  2889. /// </summary>
  2890. /// <param name="documentationTextBox">Reference to the text box control which contains the documentation.</param>
  2891. /// <param name="operation">Reference to an instance of <see cref="Operation"/> class which belongs the documentation.</param>
  2892. public OperationDocumentationTextBoxController(TextBox documentationTextBox, Operation operation)
  2893. {
  2894. this.currentTextBox = documentationTextBox;
  2895. this.operation = operation;
  2896. // Attach the event handlers.
  2897. currentTextBox.TextChanged += new EventHandler(TextBox_TextChanged);
  2898. }
  2899. #endregion
  2900. #region Event handlers
  2901. /// <summary>
  2902. /// Performs the actions when the text box content changes.
  2903. /// </summary>
  2904. /// <param name="sender">The event source.</param>
  2905. /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
  2906. /// <remarks>This method updates the <see cref="Operation"/> object's documentation property.</remarks>
  2907. private void TextBox_TextChanged(object sender, EventArgs e)
  2908. {
  2909. this.operation.Documentation = currentTextBox.Text;
  2910. }
  2911. #endregion
  2912. }
  2913. #endregion
  2914. }
  2915. }