ViewPackagesDlg.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /**
  2. Licensed Materials - Property of IBM
  3. IBM Cognos Products: DOCS
  4. (C) Copyright IBM Corp. 2005
  5. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with
  6. IBM Corp.
  7. */
  8. using System;
  9. using System.Drawing;
  10. using System.Collections;
  11. using System.ComponentModel;
  12. using System.Windows.Forms;
  13. using System.Web.Services.Protocols;
  14. using SamplesCommon;
  15. using cognosdotnet_10_2;
  16. namespace ViewPackages
  17. {
  18. /// <summary>
  19. /// Summary description for ViewPackagesDlg.
  20. /// </summary>
  21. public class ViewPackagesDlg : System.Windows.Forms.Form
  22. {
  23. private System.Windows.Forms.MainMenu mainMenu1;
  24. private System.Windows.Forms.MenuItem menuItemFile;
  25. private System.Windows.Forms.MenuItem menuItemExit;
  26. private System.Windows.Forms.MenuItem menuItemHelp;
  27. private System.Windows.Forms.MenuItem menuItemAbout;
  28. private System.Windows.Forms.Label ServerUrlLBL;
  29. private System.Windows.Forms.Button buttonViewPackages;
  30. private System.Windows.Forms.GroupBox resultsDisplayWindoRTB;
  31. private IContainer components;
  32. private System.Windows.Forms.RichTextBox resultsDisplayWindowRTB;
  33. private System.Windows.Forms.TextBox serverUrlTB;
  34. private contentManagerService1 cBIServer = null;
  35. public ViewPackagesDlg()
  36. {
  37. //
  38. // Required for Windows Form Designer support
  39. //
  40. InitializeComponent();
  41. //
  42. // TODO: Add any constructor code after InitializeComponent call
  43. //
  44. }
  45. /// <summary>
  46. /// Clean up any resources being used.
  47. /// </summary>
  48. protected override void Dispose( bool disposing )
  49. {
  50. if( disposing )
  51. {
  52. if(components != null)
  53. {
  54. components.Dispose();
  55. }
  56. }
  57. base.Dispose( disposing );
  58. }
  59. #region Windows Form Designer generated code
  60. /// <summary>
  61. /// Required method for Designer support - do not modify
  62. /// the contents of this method with the code editor.
  63. /// </summary>
  64. private void InitializeComponent()
  65. {
  66. this.components = new System.ComponentModel.Container();
  67. System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ViewPackagesDlg));
  68. this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
  69. this.menuItemFile = new System.Windows.Forms.MenuItem();
  70. this.menuItemExit = new System.Windows.Forms.MenuItem();
  71. this.menuItemHelp = new System.Windows.Forms.MenuItem();
  72. this.menuItemAbout = new System.Windows.Forms.MenuItem();
  73. this.ServerUrlLBL = new System.Windows.Forms.Label();
  74. this.serverUrlTB = new System.Windows.Forms.TextBox();
  75. this.buttonViewPackages = new System.Windows.Forms.Button();
  76. this.resultsDisplayWindoRTB = new System.Windows.Forms.GroupBox();
  77. this.resultsDisplayWindowRTB = new System.Windows.Forms.RichTextBox();
  78. this.resultsDisplayWindoRTB.SuspendLayout();
  79. this.SuspendLayout();
  80. //
  81. // mainMenu1
  82. //
  83. this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  84. this.menuItemFile,
  85. this.menuItemHelp});
  86. //
  87. // menuItemFile
  88. //
  89. this.menuItemFile.Index = 0;
  90. this.menuItemFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  91. this.menuItemExit});
  92. this.menuItemFile.Text = "File";
  93. //
  94. // menuItemExit
  95. //
  96. this.menuItemExit.Index = 0;
  97. this.menuItemExit.Text = "Exit";
  98. this.menuItemExit.Click += new System.EventHandler(this.menuItemExit_Click);
  99. //
  100. // menuItemHelp
  101. //
  102. this.menuItemHelp.Index = 1;
  103. this.menuItemHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  104. this.menuItemAbout});
  105. this.menuItemHelp.Text = "Help";
  106. //
  107. // menuItemAbout
  108. //
  109. this.menuItemAbout.Index = 0;
  110. this.menuItemAbout.Text = "About";
  111. this.menuItemAbout.Click += new System.EventHandler(this.menuItemAbout_Click);
  112. //
  113. // ServerUrlLBL
  114. //
  115. this.ServerUrlLBL.Location = new System.Drawing.Point(16, 16);
  116. this.ServerUrlLBL.Name = "ServerUrlLBL";
  117. this.ServerUrlLBL.Size = new System.Drawing.Size(137, 16);
  118. this.ServerUrlLBL.TabIndex = 0;
  119. this.ServerUrlLBL.Text = "Server URL";
  120. this.ServerUrlLBL.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
  121. //
  122. // serverUrlTB
  123. //
  124. this.serverUrlTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  125. | System.Windows.Forms.AnchorStyles.Right)));
  126. this.serverUrlTB.BackColor = System.Drawing.SystemColors.Control;
  127. this.serverUrlTB.Location = new System.Drawing.Point(159, 16);
  128. this.serverUrlTB.Name = "serverUrlTB";
  129. this.serverUrlTB.Size = new System.Drawing.Size(513, 20);
  130. this.serverUrlTB.TabIndex = 1;
  131. //
  132. // buttonViewPackages
  133. //
  134. this.buttonViewPackages.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  135. this.buttonViewPackages.Location = new System.Drawing.Point(568, 56);
  136. this.buttonViewPackages.Name = "buttonViewPackages";
  137. this.buttonViewPackages.Size = new System.Drawing.Size(104, 40);
  138. this.buttonViewPackages.TabIndex = 2;
  139. this.buttonViewPackages.Text = "View Packages";
  140. this.buttonViewPackages.Click += new System.EventHandler(this.buttonViewPackages_Click);
  141. //
  142. // resultsDisplayWindoRTB
  143. //
  144. this.resultsDisplayWindoRTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  145. | System.Windows.Forms.AnchorStyles.Right)));
  146. this.resultsDisplayWindoRTB.Controls.Add(this.resultsDisplayWindowRTB);
  147. this.resultsDisplayWindoRTB.Location = new System.Drawing.Point(16, 104);
  148. this.resultsDisplayWindoRTB.Name = "resultsDisplayWindoRTB";
  149. this.resultsDisplayWindoRTB.Size = new System.Drawing.Size(656, 296);
  150. this.resultsDisplayWindoRTB.TabIndex = 3;
  151. this.resultsDisplayWindoRTB.TabStop = false;
  152. this.resultsDisplayWindoRTB.Text = "Results Display Window";
  153. //
  154. // resultsDisplayWindowRTB
  155. //
  156. this.resultsDisplayWindowRTB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  157. | System.Windows.Forms.AnchorStyles.Left)
  158. | System.Windows.Forms.AnchorStyles.Right)));
  159. this.resultsDisplayWindowRTB.BackColor = System.Drawing.SystemColors.Control;
  160. this.resultsDisplayWindowRTB.Location = new System.Drawing.Point(8, 16);
  161. this.resultsDisplayWindowRTB.Name = "resultsDisplayWindowRTB";
  162. this.resultsDisplayWindowRTB.Size = new System.Drawing.Size(640, 272);
  163. this.resultsDisplayWindowRTB.TabIndex = 0;
  164. this.resultsDisplayWindowRTB.Text = "";
  165. //
  166. // ViewPackagesDlg
  167. //
  168. this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  169. this.ClientSize = new System.Drawing.Size(696, 417);
  170. this.Controls.Add(this.resultsDisplayWindoRTB);
  171. this.Controls.Add(this.buttonViewPackages);
  172. this.Controls.Add(this.serverUrlTB);
  173. this.Controls.Add(this.ServerUrlLBL);
  174. this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  175. this.Menu = this.mainMenu1;
  176. this.Name = "ViewPackagesDlg";
  177. this.Text = "ViewPackagesDlg";
  178. this.resultsDisplayWindoRTB.ResumeLayout(false);
  179. this.ResumeLayout(false);
  180. this.PerformLayout();
  181. }
  182. #endregion
  183. private void menuItemExit_Click(object sender, System.EventArgs e)
  184. {
  185. this.Close();
  186. }
  187. private void menuItemAbout_Click(object sender, System.EventArgs e)
  188. {
  189. SamplesAbout about = new SamplesAbout();
  190. about.applicationName = "ViewPackages Sample";
  191. about.applicationVersion = "1.1";
  192. about.Show();
  193. }
  194. private void buttonViewPackages_Click(object sender, System.EventArgs e)
  195. {
  196. string resultMessage = "";
  197. clearResultsWindow();
  198. try
  199. {
  200. ViewPackages viewPackagesObj = new ViewPackages();
  201. displayMessage("Sending queries...");
  202. viewPackagesObj.doViewPackages(cBIServer, ref resultMessage);
  203. displayMessage(resultMessage);
  204. }
  205. catch(SoapException ex)
  206. {
  207. displayMessage("\n...the operation failed.\nThe following information was returned:");
  208. displayMessage(SamplesException.getExceptionMessage( ex));
  209. return;
  210. }
  211. catch(System.Exception ex)
  212. {
  213. if (0 != ex.Message.CompareTo("INPUT_CANCELLED_BY_USER"))
  214. {
  215. SamplesException.ShowExceptionMessage( ex.Message, true, "ViewPackages Sample" );
  216. }
  217. return;
  218. }
  219. }
  220. public void setConnection(contentManagerService1 cBICMS, string cBIUrl)
  221. {
  222. cBIServer = cBICMS;
  223. serverUrlTB.Text = cBIUrl;
  224. }
  225. public void displayMessage(string message)
  226. {
  227. resultsDisplayWindowRTB.AppendText(message + "\n");
  228. }
  229. public void clearResultsWindow()
  230. {
  231. resultsDisplayWindowRTB.Clear();
  232. }
  233. }
  234. }