source: BMXNET_RPMS_dotNET_UTILITIES-BMX/trunk/cs/bmx_0200scr/BMX2/BMXNet/DServerInfo.cs@ 815

Last change on this file since 815 was 815, checked in by Sam Habiel, 14 years ago

Initial commit of C# Source Code. Now to try to get it to compile.

File size: 11.4 KB
Line 
1using System;
2using System.Drawing;
3using System.Collections;
4using System.ComponentModel;
5using System.Windows.Forms;
6using System.Diagnostics;
7
8namespace IndianHealthService.BMXNet
9{
10 /// <summary>
11 /// Prompts for RPMS Server address and port
12 /// Obtains current values, if any, from isolated storage
13 /// and uses them as defaults.
14 /// If OK, then writes values to isolated storage and returns
15 /// Address and Port as properties.
16 ///
17 /// </summary>
18 public partial class DServerInfo : System.Windows.Forms.Form
19 {
20
21 private System.Windows.Forms.Panel pnlPageBottom;
22 private System.Windows.Forms.Button cmdCancel;
23 private System.Windows.Forms.Button cmdOK;
24 private System.Windows.Forms.Panel pnlDescription;
25 private System.Windows.Forms.GroupBox grpDescriptionResourceGroup;
26 private System.Windows.Forms.Label lblDescriptionResourceGroup;
27 private System.Windows.Forms.Label label1;
28 private System.Windows.Forms.Label label2;
29 private System.Windows.Forms.TextBox txtAddress;
30 private System.Windows.Forms.TextBox txtPort;
31 private TextBox txtNamespace;
32 private Label label3;
33 /// <summary>
34 /// Required designer variable.
35 /// </summary>
36 private System.ComponentModel.Container components = null;
37
38 public DServerInfo()
39 {
40 InitializeComponent();
41 }
42
43 /// <summary>
44 /// Clean up any resources being used.
45 /// </summary>
46 protected override void Dispose( bool disposing )
47 {
48 if( disposing )
49 {
50 if(components != null)
51 {
52 components.Dispose();
53 }
54 }
55 base.Dispose( disposing );
56 }
57
58 #region Windows Form Designer generated code
59 /// <summary>
60 /// Required method for Designer support - do not modify
61 /// the contents of this method with the code editor.
62 /// </summary>
63 private void InitializeComponent()
64 {
65 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DServerInfo));
66 this.pnlPageBottom = new System.Windows.Forms.Panel();
67 this.cmdCancel = new System.Windows.Forms.Button();
68 this.cmdOK = new System.Windows.Forms.Button();
69 this.pnlDescription = new System.Windows.Forms.Panel();
70 this.grpDescriptionResourceGroup = new System.Windows.Forms.GroupBox();
71 this.lblDescriptionResourceGroup = new System.Windows.Forms.Label();
72 this.label1 = new System.Windows.Forms.Label();
73 this.label2 = new System.Windows.Forms.Label();
74 this.txtAddress = new System.Windows.Forms.TextBox();
75 this.txtPort = new System.Windows.Forms.TextBox();
76 this.txtNamespace = new System.Windows.Forms.TextBox();
77 this.label3 = new System.Windows.Forms.Label();
78 this.pnlPageBottom.SuspendLayout();
79 this.pnlDescription.SuspendLayout();
80 this.grpDescriptionResourceGroup.SuspendLayout();
81 this.SuspendLayout();
82 //
83 // pnlPageBottom
84 //
85 this.pnlPageBottom.Controls.Add(this.cmdCancel);
86 this.pnlPageBottom.Controls.Add(this.cmdOK);
87 this.pnlPageBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
88 this.pnlPageBottom.Location = new System.Drawing.Point(0, 203);
89 this.pnlPageBottom.Name = "pnlPageBottom";
90 this.pnlPageBottom.Size = new System.Drawing.Size(488, 40);
91 this.pnlPageBottom.TabIndex = 5;
92 //
93 // cmdCancel
94 //
95 this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
96 this.cmdCancel.Location = new System.Drawing.Point(376, 8);
97 this.cmdCancel.Name = "cmdCancel";
98 this.cmdCancel.Size = new System.Drawing.Size(56, 24);
99 this.cmdCancel.TabIndex = 2;
100 this.cmdCancel.Text = "Cancel";
101 this.cmdCancel.Click += new System.EventHandler(this.cmdCancel_Click);
102 //
103 // cmdOK
104 //
105 this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
106 this.cmdOK.Location = new System.Drawing.Point(296, 8);
107 this.cmdOK.Name = "cmdOK";
108 this.cmdOK.Size = new System.Drawing.Size(64, 24);
109 this.cmdOK.TabIndex = 1;
110 this.cmdOK.Text = "OK";
111 this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
112 //
113 // pnlDescription
114 //
115 this.pnlDescription.Controls.Add(this.grpDescriptionResourceGroup);
116 this.pnlDescription.Dock = System.Windows.Forms.DockStyle.Bottom;
117 this.pnlDescription.Location = new System.Drawing.Point(0, 131);
118 this.pnlDescription.Name = "pnlDescription";
119 this.pnlDescription.Size = new System.Drawing.Size(488, 72);
120 this.pnlDescription.TabIndex = 6;
121 //
122 // grpDescriptionResourceGroup
123 //
124 this.grpDescriptionResourceGroup.Controls.Add(this.lblDescriptionResourceGroup);
125 this.grpDescriptionResourceGroup.Dock = System.Windows.Forms.DockStyle.Fill;
126 this.grpDescriptionResourceGroup.Location = new System.Drawing.Point(0, 0);
127 this.grpDescriptionResourceGroup.Name = "grpDescriptionResourceGroup";
128 this.grpDescriptionResourceGroup.Size = new System.Drawing.Size(488, 72);
129 this.grpDescriptionResourceGroup.TabIndex = 1;
130 this.grpDescriptionResourceGroup.TabStop = false;
131 this.grpDescriptionResourceGroup.Text = "Description";
132 //
133 // lblDescriptionResourceGroup
134 //
135 this.lblDescriptionResourceGroup.Dock = System.Windows.Forms.DockStyle.Fill;
136 this.lblDescriptionResourceGroup.Location = new System.Drawing.Point(3, 16);
137 this.lblDescriptionResourceGroup.Name = "lblDescriptionResourceGroup";
138 this.lblDescriptionResourceGroup.Size = new System.Drawing.Size(482, 53);
139 this.lblDescriptionResourceGroup.TabIndex = 0;
140 this.lblDescriptionResourceGroup.Text = resources.GetString("lblDescriptionResourceGroup.Text");
141 //
142 // label1
143 //
144 this.label1.Location = new System.Drawing.Point(24, 24);
145 this.label1.Name = "label1";
146 this.label1.Size = new System.Drawing.Size(128, 16);
147 this.label1.TabIndex = 7;
148 this.label1.Text = "RPMS Server Address:";
149 //
150 // label2
151 //
152 this.label2.Location = new System.Drawing.Point(24, 56);
153 this.label2.Name = "label2";
154 this.label2.Size = new System.Drawing.Size(128, 16);
155 this.label2.TabIndex = 8;
156 this.label2.Text = "Server Port:";
157 //
158 // txtAddress
159 //
160 this.txtAddress.Location = new System.Drawing.Point(160, 24);
161 this.txtAddress.Name = "txtAddress";
162 this.txtAddress.Size = new System.Drawing.Size(280, 20);
163 this.txtAddress.TabIndex = 9;
164 //
165 // txtPort
166 //
167 this.txtPort.Location = new System.Drawing.Point(160, 56);
168 this.txtPort.Name = "txtPort";
169 this.txtPort.Size = new System.Drawing.Size(72, 20);
170 this.txtPort.TabIndex = 10;
171 //
172 // txtNamespace
173 //
174 this.txtNamespace.Location = new System.Drawing.Point(160, 89);
175 this.txtNamespace.Name = "txtNamespace";
176 this.txtNamespace.Size = new System.Drawing.Size(72, 20);
177 this.txtNamespace.TabIndex = 12;
178 //
179 // label3
180 //
181 this.label3.Location = new System.Drawing.Point(24, 89);
182 this.label3.Name = "label3";
183 this.label3.Size = new System.Drawing.Size(128, 16);
184 this.label3.TabIndex = 11;
185 this.label3.Text = "Server Namespace:";
186 //
187 // DServerInfo
188 //
189 this.AcceptButton = this.cmdOK;
190 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
191 this.ClientSize = new System.Drawing.Size(488, 243);
192 this.Controls.Add(this.txtNamespace);
193 this.Controls.Add(this.label3);
194 this.Controls.Add(this.txtPort);
195 this.Controls.Add(this.txtAddress);
196 this.Controls.Add(this.label2);
197 this.Controls.Add(this.label1);
198 this.Controls.Add(this.pnlDescription);
199 this.Controls.Add(this.pnlPageBottom);
200 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
201 this.Name = "DServerInfo";
202 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
203 this.Text = "RPMS Server Address";
204 this.Load += new System.EventHandler(this.DServerInfo_Load);
205 this.pnlPageBottom.ResumeLayout(false);
206 this.pnlDescription.ResumeLayout(false);
207 this.grpDescriptionResourceGroup.ResumeLayout(false);
208 this.ResumeLayout(false);
209 this.PerformLayout();
210
211 }
212 #endregion
213
214 #region Fields
215 string m_sAddress;
216 int m_nPort;
217 string m_sNamespace;
218 #endregion Fields
219
220 #region Methods
221
222 public void InitializePage(string sAddress, int nPort, string sNamespace)
223 {
224 m_sAddress = sAddress;
225 m_nPort = nPort;
226 m_sNamespace = sNamespace;
227 UpdateDialogData(true);
228 }
229
230 /// <summary>
231 /// If b is true, moves member vars into control data
232 /// otherwise, moves control data into member vars
233 /// </summary>
234 /// <param name="b"></param>
235 private void UpdateDialogData(bool b)
236 {
237 if (b == true) //move member vars into controls
238 {
239 txtAddress.Text = m_sAddress;
240 txtPort.Text = m_nPort.ToString();
241 txtNamespace.Text = m_sNamespace;
242
243 }
244 else //move control data into member vars
245 {
246 try
247 {
248 m_nPort = Convert.ToInt16(txtPort.Text);
249 }
250 catch (Exception ex)
251 {
252 Debug.Write(ex.Message);
253 m_nPort = 0;
254 }
255 m_sAddress = txtAddress.Text;
256 m_sNamespace = txtNamespace.Text;
257
258 }
259 }
260
261 private void cmdOK_Click(object sender, System.EventArgs e)
262 {
263 this.UpdateDialogData(false);
264 return;
265 }
266
267 private void cmdCancel_Click(object sender, System.EventArgs e)
268 {
269 return;
270 }
271
272 private void DServerInfo_Load(object sender, System.EventArgs e)
273 {
274 this.Activate();
275 }
276 #endregion Methods
277
278 #region Properties
279
280 /// <summary>
281 /// Gets/sets the internet address of the RPMS Server
282 /// </summary>
283 public string MServerAddress
284 {
285 get
286 {
287 return m_sAddress;
288 }
289 set
290 {
291 m_sAddress = value;
292 }
293 }
294
295 /// <summary>
296 /// Gets/sets the namespace of the RPMS Server
297 /// </summary>
298 public string MServerNamespace
299 {
300 get
301 {
302 return m_sNamespace;
303 }
304 set
305 {
306 m_sNamespace = value;
307 }
308 }
309
310 /// <summary>
311 /// Gets/sets the TCP/IP Port of the RPMS Server
312 /// </summary>
313 public int MServerPort
314 {
315 get
316 {
317 return m_nPort;
318 }
319 set
320 {
321 m_nPort = value;
322 }
323 }
324 #endregion Properties
325 }
326}
Note: See TracBrowser for help on using the repository browser.