ViewAllDlg.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. /**
  2. Licensed Materials - Property of IBM
  3. IBM Cognos Products: DOCS
  4. (C) Copyright IBM Corp. 2005, 2008
  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 SamplesCommon;
  14. using cognosdotnet_10_2;
  15. using System.Web.Services.Protocols;
  16. namespace ViewAll
  17. {
  18. /// <summary>
  19. /// Summary description for ViewAllDlg.
  20. /// </summary>
  21. public class ViewAllDlg : 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 label1;
  29. private System.Windows.Forms.GroupBox groupBox1;
  30. private System.Windows.Forms.Button viewAllButton;
  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 ViewAllDlg()
  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(ViewAllDlg));
  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.label1 = new System.Windows.Forms.Label();
  74. this.serverUrlTB = new System.Windows.Forms.TextBox();
  75. this.groupBox1 = new System.Windows.Forms.GroupBox();
  76. this.resultsDisplayWindowRTB = new System.Windows.Forms.RichTextBox();
  77. this.viewAllButton = new System.Windows.Forms.Button();
  78. this.groupBox1.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. // label1
  114. //
  115. this.label1.Location = new System.Drawing.Point(8, 16);
  116. this.label1.Name = "label1";
  117. this.label1.Size = new System.Drawing.Size(152, 16);
  118. this.label1.TabIndex = 0;
  119. this.label1.Text = "Server URL";
  120. this.label1.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(166, 16);
  128. this.serverUrlTB.Name = "serverUrlTB";
  129. this.serverUrlTB.Size = new System.Drawing.Size(482, 20);
  130. this.serverUrlTB.TabIndex = 1;
  131. //
  132. // groupBox1
  133. //
  134. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  135. | System.Windows.Forms.AnchorStyles.Left)
  136. | System.Windows.Forms.AnchorStyles.Right)));
  137. this.groupBox1.Controls.Add(this.resultsDisplayWindowRTB);
  138. this.groupBox1.Location = new System.Drawing.Point(16, 88);
  139. this.groupBox1.Name = "groupBox1";
  140. this.groupBox1.Size = new System.Drawing.Size(632, 256);
  141. this.groupBox1.TabIndex = 2;
  142. this.groupBox1.TabStop = false;
  143. this.groupBox1.Text = "Results Display Window";
  144. //
  145. // resultsDisplayWindowRTB
  146. //
  147. this.resultsDisplayWindowRTB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  148. | System.Windows.Forms.AnchorStyles.Left)
  149. | System.Windows.Forms.AnchorStyles.Right)));
  150. this.resultsDisplayWindowRTB.BackColor = System.Drawing.SystemColors.Control;
  151. this.resultsDisplayWindowRTB.Location = new System.Drawing.Point(8, 16);
  152. this.resultsDisplayWindowRTB.Name = "resultsDisplayWindowRTB";
  153. this.resultsDisplayWindowRTB.Size = new System.Drawing.Size(616, 232);
  154. this.resultsDisplayWindowRTB.TabIndex = 0;
  155. this.resultsDisplayWindowRTB.Text = "";
  156. //
  157. // viewAllButton
  158. //
  159. this.viewAllButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  160. this.viewAllButton.Location = new System.Drawing.Point(560, 48);
  161. this.viewAllButton.Name = "viewAllButton";
  162. this.viewAllButton.Size = new System.Drawing.Size(88, 32);
  163. this.viewAllButton.TabIndex = 3;
  164. this.viewAllButton.Text = "View All";
  165. this.viewAllButton.Click += new System.EventHandler(this.viewAllButton_Click);
  166. //
  167. // ViewAllDlg
  168. //
  169. this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  170. this.ClientSize = new System.Drawing.Size(664, 361);
  171. this.Controls.Add(this.viewAllButton);
  172. this.Controls.Add(this.groupBox1);
  173. this.Controls.Add(this.serverUrlTB);
  174. this.Controls.Add(this.label1);
  175. this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  176. this.Menu = this.mainMenu1;
  177. this.Name = "ViewAllDlg";
  178. this.Text = "ViewAllDlg";
  179. this.groupBox1.ResumeLayout(false);
  180. this.ResumeLayout(false);
  181. this.PerformLayout();
  182. }
  183. #endregion
  184. private void menuItemExit_Click(object sender, System.EventArgs e)
  185. {
  186. this.Close();
  187. }
  188. private void menuItemAbout_Click(object sender, System.EventArgs e)
  189. {
  190. SamplesAbout about = new SamplesAbout();
  191. about.applicationName = "ViewAll Sample";
  192. about.applicationVersion = "1.1";
  193. about.Show();
  194. }
  195. private void viewAllButton_Click(object sender, System.EventArgs e)
  196. {
  197. string resultMessage = "";
  198. clearResultsWindow();
  199. try
  200. {
  201. ViewAll viewAllObj = new ViewAll();
  202. displayMessage("Sending queries...");
  203. viewAllObj.doViewAll(cBIServer, ref resultMessage);
  204. displayMessage(resultMessage);
  205. }
  206. catch(SoapException ex)
  207. {
  208. displayMessage("\n...the operation failed.\nThe following information was returned:");
  209. displayMessage(SamplesException.getExceptionMessage( ex));
  210. return;
  211. }
  212. catch(System.Exception ex)
  213. {
  214. if (0 != ex.Message.CompareTo("INPUT_CANCELLED_BY_USER"))
  215. {
  216. SamplesException.ShowExceptionMessage( ex.Message, true, "ViewAll Sample" );
  217. }
  218. return;
  219. }
  220. }
  221. public void setConnection(contentManagerService1 cBICMS, string cBIUrl)
  222. {
  223. cBIServer = cBICMS;
  224. serverUrlTB.Text = cBIUrl;
  225. }
  226. public void displayMessage(string message)
  227. {
  228. resultsDisplayWindowRTB.AppendText(message + "\n");
  229. }
  230. public void clearResultsWindow()
  231. {
  232. resultsDisplayWindowRTB.Clear();
  233. }
  234. }
  235. }