PackageNameDlg.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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 SamplesCommon;
  14. using cognosdotnet_10_2;
  15. namespace CreateReport
  16. {
  17. /// <summary>
  18. /// Summary description for PackageNameDlg.
  19. /// </summary>
  20. public class PackageNameDlg : System.Windows.Forms.Form
  21. {
  22. private System.Windows.Forms.Label label1;
  23. private System.Windows.Forms.Button buttonOK;
  24. private System.Windows.Forms.Button buttonCancel;
  25. /// <summary>
  26. /// Required designer variable.
  27. /// </summary>
  28. private System.ComponentModel.Container components = null;
  29. private System.Windows.Forms.ComboBox packageNameCB;
  30. public bool isOKed = false;
  31. public static SamplesConnect cBIServer = null;
  32. public PackageNameDlg()
  33. {
  34. //
  35. // Required for Windows Form Designer support
  36. //
  37. InitializeComponent();
  38. //
  39. // TODO: Add any constructor code after InitializeComponent call
  40. //
  41. }
  42. /// <summary>
  43. /// Clean up any resources being used.
  44. /// </summary>
  45. protected override void Dispose( bool disposing )
  46. {
  47. if( disposing )
  48. {
  49. if(components != null)
  50. {
  51. components.Dispose();
  52. }
  53. }
  54. base.Dispose( disposing );
  55. }
  56. #region Windows Form Designer generated code
  57. /// <summary>
  58. /// Required method for Designer support - do not modify
  59. /// the contents of this method with the code editor.
  60. /// </summary>
  61. private void InitializeComponent()
  62. {
  63. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(PackageNameDlg));
  64. this.label1 = new System.Windows.Forms.Label();
  65. this.packageNameCB = new System.Windows.Forms.ComboBox();
  66. this.buttonOK = new System.Windows.Forms.Button();
  67. this.buttonCancel = new System.Windows.Forms.Button();
  68. this.SuspendLayout();
  69. //
  70. // label1
  71. //
  72. this.label1.Location = new System.Drawing.Point(16, 24);
  73. this.label1.Name = "label1";
  74. this.label1.Size = new System.Drawing.Size(136, 16);
  75. this.label1.TabIndex = 0;
  76. this.label1.Text = "Please choose a package";
  77. //
  78. // packageNameCB
  79. //
  80. this.packageNameCB.BackColor = System.Drawing.SystemColors.Control;
  81. this.packageNameCB.Location = new System.Drawing.Point(16, 48);
  82. this.packageNameCB.Name = "packageNameCB";
  83. this.packageNameCB.Size = new System.Drawing.Size(344, 21);
  84. this.packageNameCB.TabIndex = 1;
  85. //
  86. // buttonOK
  87. //
  88. this.buttonOK.Location = new System.Drawing.Point(200, 80);
  89. this.buttonOK.Name = "buttonOK";
  90. this.buttonOK.TabIndex = 2;
  91. this.buttonOK.Text = "OK";
  92. this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
  93. //
  94. // buttonCancel
  95. //
  96. this.buttonCancel.Location = new System.Drawing.Point(288, 80);
  97. this.buttonCancel.Name = "buttonCancel";
  98. this.buttonCancel.TabIndex = 3;
  99. this.buttonCancel.Text = "Cancel";
  100. this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
  101. //
  102. // PackageNameDlg
  103. //
  104. this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  105. this.ClientSize = new System.Drawing.Size(376, 110);
  106. this.ControlBox = false;
  107. this.Controls.Add(this.buttonCancel);
  108. this.Controls.Add(this.buttonOK);
  109. this.Controls.Add(this.packageNameCB);
  110. this.Controls.Add(this.label1);
  111. this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  112. this.MaximizeBox = false;
  113. this.MinimizeBox = false;
  114. this.Name = "PackageNameDlg";
  115. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
  116. this.Text = "Package";
  117. this.ResumeLayout(false);
  118. }
  119. #endregion
  120. private void buttonOK_Click(object sender, System.EventArgs e)
  121. {
  122. isOKed = true;
  123. this.Close();
  124. }
  125. private void buttonCancel_Click(object sender, System.EventArgs e)
  126. {
  127. this.Close();
  128. }
  129. public string getSelectedPackageName()
  130. {
  131. string packageName = (string)packageNameCB.SelectedItem;
  132. if ( (packageName == null) || (0 == packageName.CompareTo("")) )
  133. {
  134. MessageBox.Show("Please enter a valid package name.");
  135. }
  136. return packageName;
  137. }
  138. public void setSelectedPackage(int value)
  139. {
  140. if (packageNameCB.Items.Count >= value)
  141. {
  142. packageNameCB.SelectedIndex = value;
  143. }
  144. else
  145. {
  146. packageNameCB.SelectedIndex = 0;
  147. }
  148. }
  149. public void setPackageNames(string[] packageNames)
  150. {
  151. int nbPackages = packageNames.GetLength(0);
  152. for (int i=0; i<nbPackages; i++)
  153. {
  154. packageNameCB.Items.Add(packageNames[i]);
  155. }
  156. }
  157. public int getSelectedPackageIndex()
  158. {
  159. return packageNameCB.SelectedIndex;
  160. }
  161. public void setConnection(SamplesConnect connection)
  162. {
  163. cBIServer = connection;
  164. }
  165. }
  166. }