source: BMXNET_RPMS_dotNET_UTILITIES-BMX/trunk/cs/bmx_0200scr/BMX2/BMXNetTest/frmBMXNetTest.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: 78.6 KB
Line 
1using System;
2using System.Drawing;
3using System.Collections;
4using System.ComponentModel;
5using System.Windows.Forms;
6using System.Data;
7using IndianHealthService.BMXNet;
8using System.Security.Principal;
9using System.Diagnostics;
10using System.Xml.Xsl;
11using System.Xml;
12
13namespace IndianHealthService.BMXNet
14{
15 /// <summary>
16 /// BMXNet demo form.
17 /// </summary>
18 public partial class frmBMXNetTest : System.Windows.Forms.Form
19 {
20 /// <summary>
21 /// Required designer variable.
22 /// </summary>
23 private System.ComponentModel.Container components = null;
24
25 public frmBMXNetTest()
26 {
27 InitializeComponent();
28 m_ci = new BMXNetConnectInfo();
29 }
30
31 /// <summary>
32 /// Clean up any resources being used.
33 /// </summary>
34 protected override void Dispose( bool disposing )
35 {
36 if( disposing )
37 {
38 if (m_ci != null)
39 m_ci.CloseConnection();
40 if (components != null)
41 {
42 components.Dispose();
43 }
44 }
45 base.Dispose( disposing );
46 }
47
48 #region Windows Form Designer generated code
49 /// <summary>
50 /// Required method for Designer support - do not modify
51 /// the contents of this method with the code editor.
52 /// </summary>
53 private void InitializeComponent()
54 {
55 this.tabControl1 = new System.Windows.Forms.TabControl();
56 this.tpaQuery = new System.Windows.Forms.TabPage();
57 this.panGrid = new System.Windows.Forms.Panel();
58 this.dataGrid2 = new System.Windows.Forms.DataGrid();
59 this.panQuery = new System.Windows.Forms.Panel();
60 this.cmdAddAll = new System.Windows.Forms.Button();
61 this.cmdXML = new System.Windows.Forms.Button();
62 this.cmdTest3 = new System.Windows.Forms.Button();
63 this.cmdTest4 = new System.Windows.Forms.Button();
64 this.cmdCancelChanges = new System.Windows.Forms.Button();
65 this.cmdAcceptChanges = new System.Windows.Forms.Button();
66 this.cmdExecuteQuery = new System.Windows.Forms.Button();
67 this.txtCommand = new System.Windows.Forms.TextBox();
68 this.tpaControls = new System.Windows.Forms.TabPage();
69 this.grpControls = new System.Windows.Forms.GroupBox();
70 this.label13 = new System.Windows.Forms.Label();
71 this.label9 = new System.Windows.Forms.Label();
72 this.lstCDSex = new System.Windows.Forms.ListBox();
73 this.dtpCDDOB = new System.Windows.Forms.DateTimePicker();
74 this.calCDDOB = new System.Windows.Forms.MonthCalendar();
75 this.cboCDSelect = new System.Windows.Forms.ComboBox();
76 this.label1 = new System.Windows.Forms.Label();
77 this.txtCDName = new System.Windows.Forms.TextBox();
78 this.lblCDIntro = new System.Windows.Forms.Label();
79 this.cmdCDLoad = new System.Windows.Forms.Button();
80 this.label2 = new System.Windows.Forms.Label();
81 this.txtCDSex = new System.Windows.Forms.TextBox();
82 this.label3 = new System.Windows.Forms.Label();
83 this.txtCDDOB = new System.Windows.Forms.TextBox();
84 this.txtCDSSN = new System.Windows.Forms.TextBox();
85 this.label8 = new System.Windows.Forms.Label();
86 this.label10 = new System.Windows.Forms.Label();
87 this.label11 = new System.Windows.Forms.Label();
88 this.label12 = new System.Windows.Forms.Label();
89 this.label4 = new System.Windows.Forms.Label();
90 this.tpaConnection = new System.Windows.Forms.TabPage();
91 this.cmdStopLogging = new System.Windows.Forms.Button();
92 this.cmdStartLogging = new System.Windows.Forms.Button();
93 this.cmdTestReceiveTimeout = new System.Windows.Forms.Button();
94 this.cmdTestSilent = new System.Windows.Forms.Button();
95 this.txtServer = new System.Windows.Forms.TextBox();
96 this.txtUser = new System.Windows.Forms.TextBox();
97 this.txtDivision = new System.Windows.Forms.TextBox();
98 this.cmdChangeDivision = new System.Windows.Forms.Button();
99 this.cmdChangeContext = new System.Windows.Forms.Button();
100 this.txtContext = new System.Windows.Forms.TextBox();
101 this.cmdChangeUser = new System.Windows.Forms.Button();
102 this.cmdChangeServer = new System.Windows.Forms.Button();
103 this.tpaOther = new System.Windows.Forms.TabPage();
104 this.label19 = new System.Windows.Forms.Label();
105 this.grdAsyncResult = new System.Windows.Forms.DataGrid();
106 this.label18 = new System.Windows.Forms.Label();
107 this.txtAsyncCommand = new System.Windows.Forms.TextBox();
108 this.cmdAsyncCall = new System.Windows.Forms.Button();
109 this.label17 = new System.Windows.Forms.Label();
110 this.txtEventMessages = new System.Windows.Forms.TextBox();
111 this.label16 = new System.Windows.Forms.Label();
112 this.chkEnableEvents = new System.Windows.Forms.CheckBox();
113 this.nudEventPollingInterval = new System.Windows.Forms.NumericUpDown();
114 this.chkEventRaiseBack = new System.Windows.Forms.CheckBox();
115 this.label15 = new System.Windows.Forms.Label();
116 this.txtEventParam = new System.Windows.Forms.TextBox();
117 this.label14 = new System.Windows.Forms.Label();
118 this.cmdUnregisterEvent = new System.Windows.Forms.Button();
119 this.txtUnregisterEvent = new System.Windows.Forms.TextBox();
120 this.cmdRaiseEvent = new System.Windows.Forms.Button();
121 this.txtRaiseEvent = new System.Windows.Forms.TextBox();
122 this.cmdRegisterEvent = new System.Windows.Forms.Button();
123 this.txtRegisterEvent = new System.Windows.Forms.TextBox();
124 this.grpPiece = new System.Windows.Forms.GroupBox();
125 this.txtDelim = new System.Windows.Forms.TextBox();
126 this.label7 = new System.Windows.Forms.Label();
127 this.label6 = new System.Windows.Forms.Label();
128 this.label5 = new System.Windows.Forms.Label();
129 this.txtEnd = new System.Windows.Forms.TextBox();
130 this.txtResult = new System.Windows.Forms.TextBox();
131 this.txtNumber = new System.Windows.Forms.TextBox();
132 this.txtInput = new System.Windows.Forms.TextBox();
133 this.cmdTestPiece = new System.Windows.Forms.Button();
134 this.cmdAcquireLock = new System.Windows.Forms.Button();
135 this.cmdReleaseLock = new System.Windows.Forms.Button();
136 this.cmdEventPollingInterval = new System.Windows.Forms.Button();
137 this.tabControl1.SuspendLayout();
138 this.tpaQuery.SuspendLayout();
139 this.panGrid.SuspendLayout();
140 ((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).BeginInit();
141 this.panQuery.SuspendLayout();
142 this.tpaControls.SuspendLayout();
143 this.grpControls.SuspendLayout();
144 this.tpaConnection.SuspendLayout();
145 this.tpaOther.SuspendLayout();
146 ((System.ComponentModel.ISupportInitialize)(this.grdAsyncResult)).BeginInit();
147 ((System.ComponentModel.ISupportInitialize)(this.nudEventPollingInterval)).BeginInit();
148 this.grpPiece.SuspendLayout();
149 this.SuspendLayout();
150 //
151 // tabControl1
152 //
153 this.tabControl1.Controls.Add(this.tpaQuery);
154 this.tabControl1.Controls.Add(this.tpaControls);
155 this.tabControl1.Controls.Add(this.tpaConnection);
156 this.tabControl1.Controls.Add(this.tpaOther);
157 this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
158 this.tabControl1.Location = new System.Drawing.Point(0, 0);
159 this.tabControl1.Name = "tabControl1";
160 this.tabControl1.SelectedIndex = 0;
161 this.tabControl1.Size = new System.Drawing.Size(736, 566);
162 this.tabControl1.TabIndex = 0;
163 //
164 // tpaQuery
165 //
166 this.tpaQuery.Controls.Add(this.panGrid);
167 this.tpaQuery.Controls.Add(this.panQuery);
168 this.tpaQuery.Location = new System.Drawing.Point(4, 22);
169 this.tpaQuery.Name = "tpaQuery";
170 this.tpaQuery.Size = new System.Drawing.Size(728, 540);
171 this.tpaQuery.TabIndex = 0;
172 this.tpaQuery.Text = "RPC and Query Testing";
173 //
174 // panGrid
175 //
176 this.panGrid.Controls.Add(this.dataGrid2);
177 this.panGrid.Dock = System.Windows.Forms.DockStyle.Fill;
178 this.panGrid.Location = new System.Drawing.Point(0, 216);
179 this.panGrid.Name = "panGrid";
180 this.panGrid.Size = new System.Drawing.Size(728, 324);
181 this.panGrid.TabIndex = 43;
182 //
183 // dataGrid2
184 //
185 this.dataGrid2.AccessibleName = "DataGrid";
186 this.dataGrid2.AccessibleRole = System.Windows.Forms.AccessibleRole.Table;
187 this.dataGrid2.DataMember = "";
188 this.dataGrid2.Dock = System.Windows.Forms.DockStyle.Fill;
189 this.dataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText;
190 this.dataGrid2.Location = new System.Drawing.Point(0, 0);
191 this.dataGrid2.Name = "dataGrid2";
192 this.dataGrid2.Size = new System.Drawing.Size(728, 324);
193 this.dataGrid2.TabIndex = 40;
194 this.dataGrid2.Navigate += new System.Windows.Forms.NavigateEventHandler(this.dataGrid2_Navigate);
195 //
196 // panQuery
197 //
198 this.panQuery.Controls.Add(this.cmdAddAll);
199 this.panQuery.Controls.Add(this.cmdXML);
200 this.panQuery.Controls.Add(this.cmdTest3);
201 this.panQuery.Controls.Add(this.cmdTest4);
202 this.panQuery.Controls.Add(this.cmdCancelChanges);
203 this.panQuery.Controls.Add(this.cmdAcceptChanges);
204 this.panQuery.Controls.Add(this.cmdExecuteQuery);
205 this.panQuery.Controls.Add(this.txtCommand);
206 this.panQuery.Dock = System.Windows.Forms.DockStyle.Top;
207 this.panQuery.Location = new System.Drawing.Point(0, 0);
208 this.panQuery.Name = "panQuery";
209 this.panQuery.Size = new System.Drawing.Size(728, 216);
210 this.panQuery.TabIndex = 42;
211 //
212 // cmdAddAll
213 //
214 this.cmdAddAll.Location = new System.Drawing.Point(344, 160);
215 this.cmdAddAll.Name = "cmdAddAll";
216 this.cmdAddAll.Size = new System.Drawing.Size(56, 32);
217 this.cmdAddAll.TabIndex = 78;
218 this.cmdAddAll.Text = "Add All";
219 this.cmdAddAll.Click += new System.EventHandler(this.cmdAddAll_Click);
220 //
221 // cmdXML
222 //
223 this.cmdXML.Location = new System.Drawing.Point(448, 160);
224 this.cmdXML.Name = "cmdXML";
225 this.cmdXML.Size = new System.Drawing.Size(56, 32);
226 this.cmdXML.TabIndex = 77;
227 this.cmdXML.Text = "XML";
228 this.cmdXML.Click += new System.EventHandler(this.cmdXML_Click);
229 //
230 // cmdTest3
231 //
232 this.cmdTest3.Location = new System.Drawing.Point(648, 160);
233 this.cmdTest3.Name = "cmdTest3";
234 this.cmdTest3.Size = new System.Drawing.Size(72, 32);
235 this.cmdTest3.TabIndex = 76;
236 this.cmdTest3.Text = "Low-Level TransmitRPC Demo";
237 this.cmdTest3.Click += new System.EventHandler(this.cmdTest3_Click);
238 //
239 // cmdTest4
240 //
241 this.cmdTest4.Location = new System.Drawing.Point(560, 160);
242 this.cmdTest4.Name = "cmdTest4";
243 this.cmdTest4.Size = new System.Drawing.Size(80, 32);
244 this.cmdTest4.TabIndex = 75;
245 this.cmdTest4.Text = "Table Relations Demo";
246 this.cmdTest4.Click += new System.EventHandler(this.cmdTest4_Click);
247 //
248 // cmdCancelChanges
249 //
250 this.cmdCancelChanges.Location = new System.Drawing.Point(232, 160);
251 this.cmdCancelChanges.Name = "cmdCancelChanges";
252 this.cmdCancelChanges.Size = new System.Drawing.Size(96, 32);
253 this.cmdCancelChanges.TabIndex = 74;
254 this.cmdCancelChanges.Text = "Cancel Changes";
255 this.cmdCancelChanges.Click += new System.EventHandler(this.cmdCancelChanges_Click);
256 //
257 // cmdAcceptChanges
258 //
259 this.cmdAcceptChanges.Location = new System.Drawing.Point(120, 160);
260 this.cmdAcceptChanges.Name = "cmdAcceptChanges";
261 this.cmdAcceptChanges.Size = new System.Drawing.Size(96, 32);
262 this.cmdAcceptChanges.TabIndex = 73;
263 this.cmdAcceptChanges.Text = "Accept Changes";
264 this.cmdAcceptChanges.Click += new System.EventHandler(this.cmdAcceptChanges_Click);
265 //
266 // cmdExecuteQuery
267 //
268 this.cmdExecuteQuery.Location = new System.Drawing.Point(16, 160);
269 this.cmdExecuteQuery.Name = "cmdExecuteQuery";
270 this.cmdExecuteQuery.Size = new System.Drawing.Size(96, 32);
271 this.cmdExecuteQuery.TabIndex = 71;
272 this.cmdExecuteQuery.Text = "Execute Query";
273 this.cmdExecuteQuery.Click += new System.EventHandler(this.cmdExecuteQuery_Click);
274 //
275 // txtCommand
276 //
277 this.txtCommand.Dock = System.Windows.Forms.DockStyle.Top;
278 this.txtCommand.Location = new System.Drawing.Point(0, 0);
279 this.txtCommand.Multiline = true;
280 this.txtCommand.Name = "txtCommand";
281 this.txtCommand.Size = new System.Drawing.Size(728, 152);
282 this.txtCommand.TabIndex = 72;
283 this.txtCommand.Text = "SELECT NAME, AGE, DOB FROM VA_PATIENT WHERE NAME LIKE \'END%\'";
284 //
285 // tpaControls
286 //
287 this.tpaControls.Controls.Add(this.grpControls);
288 this.tpaControls.Location = new System.Drawing.Point(4, 22);
289 this.tpaControls.Name = "tpaControls";
290 this.tpaControls.Size = new System.Drawing.Size(728, 540);
291 this.tpaControls.TabIndex = 3;
292 this.tpaControls.Text = "Controls Demo";
293 //
294 // grpControls
295 //
296 this.grpControls.Controls.Add(this.label13);
297 this.grpControls.Controls.Add(this.label9);
298 this.grpControls.Controls.Add(this.lstCDSex);
299 this.grpControls.Controls.Add(this.dtpCDDOB);
300 this.grpControls.Controls.Add(this.calCDDOB);
301 this.grpControls.Controls.Add(this.cboCDSelect);
302 this.grpControls.Controls.Add(this.label1);
303 this.grpControls.Controls.Add(this.txtCDName);
304 this.grpControls.Controls.Add(this.lblCDIntro);
305 this.grpControls.Controls.Add(this.cmdCDLoad);
306 this.grpControls.Controls.Add(this.label2);
307 this.grpControls.Controls.Add(this.txtCDSex);
308 this.grpControls.Controls.Add(this.label3);
309 this.grpControls.Controls.Add(this.txtCDDOB);
310 this.grpControls.Controls.Add(this.txtCDSSN);
311 this.grpControls.Controls.Add(this.label8);
312 this.grpControls.Controls.Add(this.label10);
313 this.grpControls.Controls.Add(this.label11);
314 this.grpControls.Controls.Add(this.label12);
315 this.grpControls.Controls.Add(this.label4);
316 this.grpControls.Location = new System.Drawing.Point(0, 8);
317 this.grpControls.Name = "grpControls";
318 this.grpControls.Size = new System.Drawing.Size(704, 520);
319 this.grpControls.TabIndex = 72;
320 this.grpControls.TabStop = false;
321 this.grpControls.Text = "Control demo";
322 //
323 // label13
324 //
325 this.label13.Location = new System.Drawing.Point(368, 128);
326 this.label13.Name = "label13";
327 this.label13.Size = new System.Drawing.Size(176, 24);
328 this.label13.TabIndex = 9;
329 this.label13.Text = "<-- Select a patient after loading the dataset";
330 //
331 // label9
332 //
333 this.label9.Location = new System.Drawing.Point(144, 80);
334 this.label9.Name = "label9";
335 this.label9.Size = new System.Drawing.Size(312, 24);
336 this.label9.TabIndex = 8;
337 this.label9.Text = "<---Press this button to load first 50 patients from VA Patient file into a datas" +
338 "et.";
339 //
340 // lstCDSex
341 //
342 this.lstCDSex.Items.AddRange(new object[] {
343 "MALE",
344 "FEMALE"});
345 this.lstCDSex.Location = new System.Drawing.Point(224, 264);
346 this.lstCDSex.Name = "lstCDSex";
347 this.lstCDSex.Size = new System.Drawing.Size(112, 17);
348 this.lstCDSex.TabIndex = 7;
349 //
350 // dtpCDDOB
351 //
352 this.dtpCDDOB.CustomFormat = "MMMM dd, yyyy";
353 this.dtpCDDOB.Location = new System.Drawing.Point(72, 392);
354 this.dtpCDDOB.Name = "dtpCDDOB";
355 this.dtpCDDOB.Size = new System.Drawing.Size(264, 20);
356 this.dtpCDDOB.TabIndex = 6;
357 //
358 // calCDDOB
359 //
360 this.calCDDOB.Location = new System.Drawing.Point(360, 344);
361 this.calCDDOB.Name = "calCDDOB";
362 this.calCDDOB.TabIndex = 5;
363 //
364 // cboCDSelect
365 //
366 this.cboCDSelect.Location = new System.Drawing.Point(96, 128);
367 this.cboCDSelect.Name = "cboCDSelect";
368 this.cboCDSelect.Size = new System.Drawing.Size(256, 21);
369 this.cboCDSelect.TabIndex = 4;
370 //
371 // label1
372 //
373 this.label1.Location = new System.Drawing.Point(16, 168);
374 this.label1.Name = "label1";
375 this.label1.Size = new System.Drawing.Size(40, 16);
376 this.label1.TabIndex = 3;
377 this.label1.Text = "Name:";
378 //
379 // txtCDName
380 //
381 this.txtCDName.Location = new System.Drawing.Point(72, 168);
382 this.txtCDName.Name = "txtCDName";
383 this.txtCDName.Size = new System.Drawing.Size(280, 20);
384 this.txtCDName.TabIndex = 2;
385 //
386 // lblCDIntro
387 //
388 this.lblCDIntro.Location = new System.Drawing.Point(24, 24);
389 this.lblCDIntro.Name = "lblCDIntro";
390 this.lblCDIntro.Size = new System.Drawing.Size(376, 32);
391 this.lblCDIntro.TabIndex = 1;
392 this.lblCDIntro.Text = "This panel demonstrates how to load data into various kinds of controls from a da" +
393 "taset.";
394 //
395 // cmdCDLoad
396 //
397 this.cmdCDLoad.Location = new System.Drawing.Point(32, 72);
398 this.cmdCDLoad.Name = "cmdCDLoad";
399 this.cmdCDLoad.Size = new System.Drawing.Size(96, 32);
400 this.cmdCDLoad.TabIndex = 0;
401 this.cmdCDLoad.Text = "Load Dataset";
402 this.cmdCDLoad.Click += new System.EventHandler(this.cmdCDLoad_Click);
403 //
404 // label2
405 //
406 this.label2.Location = new System.Drawing.Point(8, 128);
407 this.label2.Name = "label2";
408 this.label2.Size = new System.Drawing.Size(80, 16);
409 this.label2.TabIndex = 3;
410 this.label2.Text = "Select Patient:";
411 //
412 // txtCDSex
413 //
414 this.txtCDSex.Location = new System.Drawing.Point(72, 264);
415 this.txtCDSex.Name = "txtCDSex";
416 this.txtCDSex.Size = new System.Drawing.Size(72, 20);
417 this.txtCDSex.TabIndex = 2;
418 //
419 // label3
420 //
421 this.label3.Location = new System.Drawing.Point(72, 240);
422 this.label3.Name = "label3";
423 this.label3.Size = new System.Drawing.Size(128, 16);
424 this.label3.TabIndex = 3;
425 this.label3.Text = "Sex (Text Control):";
426 //
427 // txtCDDOB
428 //
429 this.txtCDDOB.Location = new System.Drawing.Point(72, 344);
430 this.txtCDDOB.Name = "txtCDDOB";
431 this.txtCDDOB.Size = new System.Drawing.Size(144, 20);
432 this.txtCDDOB.TabIndex = 2;
433 //
434 // txtCDSSN
435 //
436 this.txtCDSSN.Location = new System.Drawing.Point(72, 200);
437 this.txtCDSSN.Name = "txtCDSSN";
438 this.txtCDSSN.Size = new System.Drawing.Size(280, 20);
439 this.txtCDSSN.TabIndex = 2;
440 //
441 // label8
442 //
443 this.label8.Location = new System.Drawing.Point(16, 200);
444 this.label8.Name = "label8";
445 this.label8.Size = new System.Drawing.Size(40, 16);
446 this.label8.TabIndex = 3;
447 this.label8.Text = "SSN:";
448 //
449 // label10
450 //
451 this.label10.Location = new System.Drawing.Point(72, 368);
452 this.label10.Name = "label10";
453 this.label10.Size = new System.Drawing.Size(136, 16);
454 this.label10.TabIndex = 3;
455 this.label10.Text = "DOB (DateTime Picker):";
456 //
457 // label11
458 //
459 this.label11.Location = new System.Drawing.Point(72, 320);
460 this.label11.Name = "label11";
461 this.label11.Size = new System.Drawing.Size(128, 16);
462 this.label11.TabIndex = 3;
463 this.label11.Text = "DOB (Text Control):";
464 //
465 // label12
466 //
467 this.label12.Location = new System.Drawing.Point(360, 320);
468 this.label12.Name = "label12";
469 this.label12.Size = new System.Drawing.Size(200, 16);
470 this.label12.TabIndex = 3;
471 this.label12.Text = "DOB (Calendar Control):";
472 //
473 // label4
474 //
475 this.label4.Location = new System.Drawing.Point(224, 240);
476 this.label4.Name = "label4";
477 this.label4.Size = new System.Drawing.Size(128, 16);
478 this.label4.TabIndex = 3;
479 this.label4.Text = "Sex (ListBox Control):";
480 //
481 // tpaConnection
482 //
483 this.tpaConnection.Controls.Add(this.cmdStopLogging);
484 this.tpaConnection.Controls.Add(this.cmdStartLogging);
485 this.tpaConnection.Controls.Add(this.cmdTestReceiveTimeout);
486 this.tpaConnection.Controls.Add(this.cmdTestSilent);
487 this.tpaConnection.Controls.Add(this.txtServer);
488 this.tpaConnection.Controls.Add(this.txtUser);
489 this.tpaConnection.Controls.Add(this.txtDivision);
490 this.tpaConnection.Controls.Add(this.cmdChangeDivision);
491 this.tpaConnection.Controls.Add(this.cmdChangeContext);
492 this.tpaConnection.Controls.Add(this.txtContext);
493 this.tpaConnection.Controls.Add(this.cmdChangeUser);
494 this.tpaConnection.Controls.Add(this.cmdChangeServer);
495 this.tpaConnection.Location = new System.Drawing.Point(4, 22);
496 this.tpaConnection.Name = "tpaConnection";
497 this.tpaConnection.Size = new System.Drawing.Size(605, 465);
498 this.tpaConnection.TabIndex = 1;
499 this.tpaConnection.Text = "Connection";
500 //
501 // cmdStopLogging
502 //
503 this.cmdStopLogging.Location = new System.Drawing.Point(16, 393);
504 this.cmdStopLogging.Name = "cmdStopLogging";
505 this.cmdStopLogging.Size = new System.Drawing.Size(152, 28);
506 this.cmdStopLogging.TabIndex = 85;
507 this.cmdStopLogging.Text = "Stop Logging";
508 this.cmdStopLogging.UseVisualStyleBackColor = true;
509 this.cmdStopLogging.Click += new System.EventHandler(this.cmdStopLogging_Click);
510 //
511 // cmdStartLogging
512 //
513 this.cmdStartLogging.Location = new System.Drawing.Point(16, 346);
514 this.cmdStartLogging.Name = "cmdStartLogging";
515 this.cmdStartLogging.Size = new System.Drawing.Size(152, 28);
516 this.cmdStartLogging.TabIndex = 84;
517 this.cmdStartLogging.Text = "Start Logging";
518 this.cmdStartLogging.UseVisualStyleBackColor = true;
519 this.cmdStartLogging.Click += new System.EventHandler(this.cmdStartLogging_Click);
520 //
521 // cmdTestReceiveTimeout
522 //
523 this.cmdTestReceiveTimeout.Location = new System.Drawing.Point(16, 294);
524 this.cmdTestReceiveTimeout.Name = "cmdTestReceiveTimeout";
525 this.cmdTestReceiveTimeout.Size = new System.Drawing.Size(152, 28);
526 this.cmdTestReceiveTimeout.TabIndex = 83;
527 this.cmdTestReceiveTimeout.Text = "Test Receive Timeout";
528 this.cmdTestReceiveTimeout.UseVisualStyleBackColor = true;
529 this.cmdTestReceiveTimeout.Visible = false;
530 this.cmdTestReceiveTimeout.Click += new System.EventHandler(this.cmdTestReceiveTimeout_Click);
531 //
532 // cmdTestSilent
533 //
534 this.cmdTestSilent.Location = new System.Drawing.Point(16, 248);
535 this.cmdTestSilent.Name = "cmdTestSilent";
536 this.cmdTestSilent.Size = new System.Drawing.Size(152, 28);
537 this.cmdTestSilent.TabIndex = 82;
538 this.cmdTestSilent.Text = "Test Silent Login";
539 this.cmdTestSilent.UseVisualStyleBackColor = true;
540 this.cmdTestSilent.Visible = false;
541 this.cmdTestSilent.Click += new System.EventHandler(this.cmdTestSilent_Click);
542 //
543 // txtServer
544 //
545 this.txtServer.Location = new System.Drawing.Point(176, 24);
546 this.txtServer.Name = "txtServer";
547 this.txtServer.ReadOnly = true;
548 this.txtServer.Size = new System.Drawing.Size(200, 20);
549 this.txtServer.TabIndex = 81;
550 //
551 // txtUser
552 //
553 this.txtUser.Location = new System.Drawing.Point(176, 64);
554 this.txtUser.Name = "txtUser";
555 this.txtUser.ReadOnly = true;
556 this.txtUser.Size = new System.Drawing.Size(200, 20);
557 this.txtUser.TabIndex = 80;
558 //
559 // txtDivision
560 //
561 this.txtDivision.Location = new System.Drawing.Point(176, 104);
562 this.txtDivision.Name = "txtDivision";
563 this.txtDivision.Size = new System.Drawing.Size(200, 20);
564 this.txtDivision.TabIndex = 79;
565 //
566 // cmdChangeDivision
567 //
568 this.cmdChangeDivision.Location = new System.Drawing.Point(16, 96);
569 this.cmdChangeDivision.Name = "cmdChangeDivision";
570 this.cmdChangeDivision.Size = new System.Drawing.Size(152, 32);
571 this.cmdChangeDivision.TabIndex = 78;
572 this.cmdChangeDivision.Text = "Change Division";
573 this.cmdChangeDivision.Click += new System.EventHandler(this.cmdChangeDivision_Click);
574 //
575 // cmdChangeContext
576 //
577 this.cmdChangeContext.Location = new System.Drawing.Point(16, 136);
578 this.cmdChangeContext.Name = "cmdChangeContext";
579 this.cmdChangeContext.Size = new System.Drawing.Size(152, 32);
580 this.cmdChangeContext.TabIndex = 77;
581 this.cmdChangeContext.Text = "Change Application Context";
582 this.cmdChangeContext.Click += new System.EventHandler(this.cmdChangeContext_Click);
583 //
584 // txtContext
585 //
586 this.txtContext.Location = new System.Drawing.Point(176, 144);
587 this.txtContext.Name = "txtContext";
588 this.txtContext.Size = new System.Drawing.Size(200, 20);
589 this.txtContext.TabIndex = 76;
590 //
591 // cmdChangeUser
592 //
593 this.cmdChangeUser.Location = new System.Drawing.Point(16, 56);
594 this.cmdChangeUser.Name = "cmdChangeUser";
595 this.cmdChangeUser.Size = new System.Drawing.Size(152, 32);
596 this.cmdChangeUser.TabIndex = 74;
597 this.cmdChangeUser.Text = "Change RPMS User Login";
598 this.cmdChangeUser.Click += new System.EventHandler(this.cmdChangeUser_Click);
599 //
600 // cmdChangeServer
601 //
602 this.cmdChangeServer.Location = new System.Drawing.Point(16, 16);
603 this.cmdChangeServer.Name = "cmdChangeServer";
604 this.cmdChangeServer.Size = new System.Drawing.Size(152, 32);
605 this.cmdChangeServer.TabIndex = 73;
606 this.cmdChangeServer.Text = "Change RPMS Server";
607 this.cmdChangeServer.Click += new System.EventHandler(this.cmdChangeServer_Click);
608 //
609 // tpaOther
610 //
611 this.tpaOther.Controls.Add(this.label19);
612 this.tpaOther.Controls.Add(this.grdAsyncResult);
613 this.tpaOther.Controls.Add(this.label18);
614 this.tpaOther.Controls.Add(this.txtAsyncCommand);
615 this.tpaOther.Controls.Add(this.cmdAsyncCall);
616 this.tpaOther.Controls.Add(this.label17);
617 this.tpaOther.Controls.Add(this.txtEventMessages);
618 this.tpaOther.Controls.Add(this.label16);
619 this.tpaOther.Controls.Add(this.chkEnableEvents);
620 this.tpaOther.Controls.Add(this.nudEventPollingInterval);
621 this.tpaOther.Controls.Add(this.chkEventRaiseBack);
622 this.tpaOther.Controls.Add(this.label15);
623 this.tpaOther.Controls.Add(this.txtEventParam);
624 this.tpaOther.Controls.Add(this.label14);
625 this.tpaOther.Controls.Add(this.cmdUnregisterEvent);
626 this.tpaOther.Controls.Add(this.txtUnregisterEvent);
627 this.tpaOther.Controls.Add(this.cmdRaiseEvent);
628 this.tpaOther.Controls.Add(this.txtRaiseEvent);
629 this.tpaOther.Controls.Add(this.cmdRegisterEvent);
630 this.tpaOther.Controls.Add(this.txtRegisterEvent);
631 this.tpaOther.Controls.Add(this.grpPiece);
632 this.tpaOther.Controls.Add(this.cmdAcquireLock);
633 this.tpaOther.Controls.Add(this.cmdReleaseLock);
634 this.tpaOther.Controls.Add(this.cmdEventPollingInterval);
635 this.tpaOther.Location = new System.Drawing.Point(4, 22);
636 this.tpaOther.Name = "tpaOther";
637 this.tpaOther.Size = new System.Drawing.Size(605, 465);
638 this.tpaOther.TabIndex = 2;
639 this.tpaOther.Text = "Events";
640 //
641 // label19
642 //
643 this.label19.Location = new System.Drawing.Point(416, 176);
644 this.label19.Name = "label19";
645 this.label19.Size = new System.Drawing.Size(160, 16);
646 this.label19.TabIndex = 107;
647 this.label19.Text = "Asyncronous Result Set";
648 //
649 // grdAsyncResult
650 //
651 this.grdAsyncResult.DataMember = "";
652 this.grdAsyncResult.HeaderForeColor = System.Drawing.SystemColors.ControlText;
653 this.grdAsyncResult.Location = new System.Drawing.Point(416, 192);
654 this.grdAsyncResult.Name = "grdAsyncResult";
655 this.grdAsyncResult.Size = new System.Drawing.Size(296, 304);
656 this.grdAsyncResult.TabIndex = 106;
657 //
658 // label18
659 //
660 this.label18.Location = new System.Drawing.Point(416, 40);
661 this.label18.Name = "label18";
662 this.label18.Size = new System.Drawing.Size(160, 16);
663 this.label18.TabIndex = 105;
664 this.label18.Text = "Command String:";
665 //
666 // txtAsyncCommand
667 //
668 this.txtAsyncCommand.Location = new System.Drawing.Point(416, 56);
669 this.txtAsyncCommand.Multiline = true;
670 this.txtAsyncCommand.Name = "txtAsyncCommand";
671 this.txtAsyncCommand.Size = new System.Drawing.Size(288, 48);
672 this.txtAsyncCommand.TabIndex = 104;
673 this.txtAsyncCommand.Text = "BMX DEMO^W^15";
674 //
675 // cmdAsyncCall
676 //
677 this.cmdAsyncCall.Location = new System.Drawing.Point(416, 120);
678 this.cmdAsyncCall.Name = "cmdAsyncCall";
679 this.cmdAsyncCall.Size = new System.Drawing.Size(144, 32);
680 this.cmdAsyncCall.TabIndex = 103;
681 this.cmdAsyncCall.Text = "Make Asynchronous Call";
682 this.cmdAsyncCall.Click += new System.EventHandler(this.cmdAsyncCall_Click);
683 //
684 // label17
685 //
686 this.label17.Location = new System.Drawing.Point(24, 288);
687 this.label17.Name = "label17";
688 this.label17.Size = new System.Drawing.Size(160, 16);
689 this.label17.TabIndex = 102;
690 this.label17.Text = "Event Messages";
691 //
692 // txtEventMessages
693 //
694 this.txtEventMessages.Location = new System.Drawing.Point(24, 304);
695 this.txtEventMessages.Multiline = true;
696 this.txtEventMessages.Name = "txtEventMessages";
697 this.txtEventMessages.Size = new System.Drawing.Size(360, 40);
698 this.txtEventMessages.TabIndex = 101;
699 //
700 // label16
701 //
702 this.label16.Location = new System.Drawing.Point(272, 232);
703 this.label16.Name = "label16";
704 this.label16.Size = new System.Drawing.Size(96, 16);
705 this.label16.TabIndex = 100;
706 this.label16.Text = "(milliseconds)";
707 //
708 // chkEnableEvents
709 //
710 this.chkEnableEvents.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
711 this.chkEnableEvents.Location = new System.Drawing.Point(184, 16);
712 this.chkEnableEvents.Name = "chkEnableEvents";
713 this.chkEnableEvents.Size = new System.Drawing.Size(104, 16);
714 this.chkEnableEvents.TabIndex = 99;
715 this.chkEnableEvents.Text = "Enable Events";
716 this.chkEnableEvents.CheckedChanged += new System.EventHandler(this.chkEnableEvents_CheckedChanged);
717 //
718 // nudEventPollingInterval
719 //
720 this.nudEventPollingInterval.Increment = new decimal(new int[] {
721 500,
722 0,
723 0,
724 0});
725 this.nudEventPollingInterval.Location = new System.Drawing.Point(192, 232);
726 this.nudEventPollingInterval.Maximum = new decimal(new int[] {
727 10000,
728 0,
729 0,
730 0});
731 this.nudEventPollingInterval.Minimum = new decimal(new int[] {
732 1,
733 0,
734 0,
735 0});
736 this.nudEventPollingInterval.Name = "nudEventPollingInterval";
737 this.nudEventPollingInterval.Size = new System.Drawing.Size(64, 20);
738 this.nudEventPollingInterval.TabIndex = 98;
739 this.nudEventPollingInterval.Value = new decimal(new int[] {
740 3000,
741 0,
742 0,
743 0});
744 this.nudEventPollingInterval.ValueChanged += new System.EventHandler(this.nudEventPollingInterval_ValueChanged);
745 //
746 // chkEventRaiseBack
747 //
748 this.chkEventRaiseBack.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
749 this.chkEventRaiseBack.Checked = true;
750 this.chkEventRaiseBack.CheckState = System.Windows.Forms.CheckState.Checked;
751 this.chkEventRaiseBack.Location = new System.Drawing.Point(192, 160);
752 this.chkEventRaiseBack.Name = "chkEventRaiseBack";
753 this.chkEventRaiseBack.Size = new System.Drawing.Size(96, 16);
754 this.chkEventRaiseBack.TabIndex = 97;
755 this.chkEventRaiseBack.Text = "Raise Back";
756 //
757 // label15
758 //
759 this.label15.Location = new System.Drawing.Point(192, 128);
760 this.label15.Name = "label15";
761 this.label15.Size = new System.Drawing.Size(48, 16);
762 this.label15.TabIndex = 96;
763 this.label15.Text = "Param";
764 //
765 // txtEventParam
766 //
767 this.txtEventParam.Location = new System.Drawing.Point(240, 128);
768 this.txtEventParam.Name = "txtEventParam";
769 this.txtEventParam.Size = new System.Drawing.Size(144, 20);
770 this.txtEventParam.TabIndex = 95;
771 //
772 // label14
773 //
774 this.label14.Location = new System.Drawing.Point(192, 98);
775 this.label14.Name = "label14";
776 this.label14.Size = new System.Drawing.Size(48, 16);
777 this.label14.TabIndex = 94;
778 this.label14.Text = "Event";
779 //
780 // cmdUnregisterEvent
781 //
782 this.cmdUnregisterEvent.Location = new System.Drawing.Point(24, 184);
783 this.cmdUnregisterEvent.Name = "cmdUnregisterEvent";
784 this.cmdUnregisterEvent.Size = new System.Drawing.Size(152, 32);
785 this.cmdUnregisterEvent.TabIndex = 93;
786 this.cmdUnregisterEvent.Text = "UnSubscribe Event";
787 this.cmdUnregisterEvent.Click += new System.EventHandler(this.cmdUnregisterEvent_Click);
788 //
789 // txtUnregisterEvent
790 //
791 this.txtUnregisterEvent.Location = new System.Drawing.Point(184, 192);
792 this.txtUnregisterEvent.Name = "txtUnregisterEvent";
793 this.txtUnregisterEvent.Size = new System.Drawing.Size(200, 20);
794 this.txtUnregisterEvent.TabIndex = 92;
795 //
796 // cmdRaiseEvent
797 //
798 this.cmdRaiseEvent.Location = new System.Drawing.Point(24, 88);
799 this.cmdRaiseEvent.Name = "cmdRaiseEvent";
800 this.cmdRaiseEvent.Size = new System.Drawing.Size(152, 32);
801 this.cmdRaiseEvent.TabIndex = 91;
802 this.cmdRaiseEvent.Text = "Raise Event";
803 this.cmdRaiseEvent.Click += new System.EventHandler(this.cmdRaiseEvent_Click);
804 //
805 // txtRaiseEvent
806 //
807 this.txtRaiseEvent.Location = new System.Drawing.Point(240, 96);
808 this.txtRaiseEvent.Name = "txtRaiseEvent";
809 this.txtRaiseEvent.Size = new System.Drawing.Size(144, 20);
810 this.txtRaiseEvent.TabIndex = 90;
811 //
812 // cmdRegisterEvent
813 //
814 this.cmdRegisterEvent.Location = new System.Drawing.Point(24, 48);
815 this.cmdRegisterEvent.Name = "cmdRegisterEvent";
816 this.cmdRegisterEvent.Size = new System.Drawing.Size(152, 32);
817 this.cmdRegisterEvent.TabIndex = 89;
818 this.cmdRegisterEvent.Text = "Subscribe Event";
819 this.cmdRegisterEvent.Click += new System.EventHandler(this.cmdRegisterEvent_Click);
820 //
821 // txtRegisterEvent
822 //
823 this.txtRegisterEvent.Location = new System.Drawing.Point(184, 56);
824 this.txtRegisterEvent.Name = "txtRegisterEvent";
825 this.txtRegisterEvent.Size = new System.Drawing.Size(200, 20);
826 this.txtRegisterEvent.TabIndex = 88;
827 //
828 // grpPiece
829 //
830 this.grpPiece.Controls.Add(this.txtDelim);
831 this.grpPiece.Controls.Add(this.label7);
832 this.grpPiece.Controls.Add(this.label6);
833 this.grpPiece.Controls.Add(this.label5);
834 this.grpPiece.Controls.Add(this.txtEnd);
835 this.grpPiece.Controls.Add(this.txtResult);
836 this.grpPiece.Controls.Add(this.txtNumber);
837 this.grpPiece.Controls.Add(this.txtInput);
838 this.grpPiece.Controls.Add(this.cmdTestPiece);
839 this.grpPiece.Enabled = false;
840 this.grpPiece.Location = new System.Drawing.Point(24, 408);
841 this.grpPiece.Name = "grpPiece";
842 this.grpPiece.Size = new System.Drawing.Size(264, 120);
843 this.grpPiece.TabIndex = 71;
844 this.grpPiece.TabStop = false;
845 this.grpPiece.Text = "Piece Function Testing";
846 this.grpPiece.Visible = false;
847 //
848 // txtDelim
849 //
850 this.txtDelim.Location = new System.Drawing.Point(24, 56);
851 this.txtDelim.Name = "txtDelim";
852 this.txtDelim.Size = new System.Drawing.Size(16, 20);
853 this.txtDelim.TabIndex = 55;
854 this.txtDelim.Text = "^";
855 //
856 // label7
857 //
858 this.label7.Location = new System.Drawing.Point(96, 40);
859 this.label7.Name = "label7";
860 this.label7.Size = new System.Drawing.Size(48, 16);
861 this.label7.TabIndex = 54;
862 this.label7.Text = "End:";
863 this.label7.TextAlign = System.Drawing.ContentAlignment.TopRight;
864 //
865 // label6
866 //
867 this.label6.Location = new System.Drawing.Point(48, 40);
868 this.label6.Name = "label6";
869 this.label6.Size = new System.Drawing.Size(48, 16);
870 this.label6.TabIndex = 53;
871 this.label6.Text = "Start:";
872 this.label6.TextAlign = System.Drawing.ContentAlignment.TopRight;
873 //
874 // label5
875 //
876 this.label5.Location = new System.Drawing.Point(8, 40);
877 this.label5.Name = "label5";
878 this.label5.Size = new System.Drawing.Size(48, 16);
879 this.label5.TabIndex = 52;
880 this.label5.Text = "Delim:";
881 this.label5.TextAlign = System.Drawing.ContentAlignment.TopRight;
882 //
883 // txtEnd
884 //
885 this.txtEnd.Location = new System.Drawing.Point(112, 56);
886 this.txtEnd.Name = "txtEnd";
887 this.txtEnd.Size = new System.Drawing.Size(32, 20);
888 this.txtEnd.TabIndex = 45;
889 this.txtEnd.Text = "3";
890 //
891 // txtResult
892 //
893 this.txtResult.Location = new System.Drawing.Point(16, 88);
894 this.txtResult.Name = "txtResult";
895 this.txtResult.Size = new System.Drawing.Size(208, 20);
896 this.txtResult.TabIndex = 44;
897 //
898 // txtNumber
899 //
900 this.txtNumber.Location = new System.Drawing.Point(64, 56);
901 this.txtNumber.Name = "txtNumber";
902 this.txtNumber.Size = new System.Drawing.Size(32, 20);
903 this.txtNumber.TabIndex = 43;
904 this.txtNumber.Text = "2";
905 //
906 // txtInput
907 //
908 this.txtInput.Location = new System.Drawing.Point(16, 16);
909 this.txtInput.Name = "txtInput";
910 this.txtInput.Size = new System.Drawing.Size(200, 20);
911 this.txtInput.TabIndex = 42;
912 this.txtInput.Text = "1^2^3^4";
913 //
914 // cmdTestPiece
915 //
916 this.cmdTestPiece.Location = new System.Drawing.Point(152, 56);
917 this.cmdTestPiece.Name = "cmdTestPiece";
918 this.cmdTestPiece.Size = new System.Drawing.Size(72, 24);
919 this.cmdTestPiece.TabIndex = 41;
920 this.cmdTestPiece.Text = "Test Piece";
921 this.cmdTestPiece.Click += new System.EventHandler(this.cmdTestPiece_Click_1);
922 //
923 // cmdAcquireLock
924 //
925 this.cmdAcquireLock.Location = new System.Drawing.Point(24, 360);
926 this.cmdAcquireLock.Name = "cmdAcquireLock";
927 this.cmdAcquireLock.Size = new System.Drawing.Size(104, 32);
928 this.cmdAcquireLock.TabIndex = 89;
929 this.cmdAcquireLock.Text = "Acquire Lock";
930 this.cmdAcquireLock.Click += new System.EventHandler(this.cmdAcquireLock_Click);
931 //
932 // cmdReleaseLock
933 //
934 this.cmdReleaseLock.Location = new System.Drawing.Point(136, 360);
935 this.cmdReleaseLock.Name = "cmdReleaseLock";
936 this.cmdReleaseLock.Size = new System.Drawing.Size(88, 32);
937 this.cmdReleaseLock.TabIndex = 89;
938 this.cmdReleaseLock.Text = "Release Lock";
939 this.cmdReleaseLock.Click += new System.EventHandler(this.cmdReleaseLock_Click);
940 //
941 // cmdEventPollingInterval
942 //
943 this.cmdEventPollingInterval.Location = new System.Drawing.Point(24, 226);
944 this.cmdEventPollingInterval.Name = "cmdEventPollingInterval";
945 this.cmdEventPollingInterval.Size = new System.Drawing.Size(152, 32);
946 this.cmdEventPollingInterval.TabIndex = 93;
947 this.cmdEventPollingInterval.Text = "Event Polling Interval";
948 //
949 // frmBMXNetTest
950 //
951 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
952 this.ClientSize = new System.Drawing.Size(736, 566);
953 this.Controls.Add(this.tabControl1);
954 this.Name = "frmBMXNetTest";
955 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
956 this.Text = "BMXNet Test Application";
957 this.Load += new System.EventHandler(this.frmBMXNetTest_Load);
958 this.tabControl1.ResumeLayout(false);
959 this.tpaQuery.ResumeLayout(false);
960 this.panGrid.ResumeLayout(false);
961 ((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).EndInit();
962 this.panQuery.ResumeLayout(false);
963 this.panQuery.PerformLayout();
964 this.tpaControls.ResumeLayout(false);
965 this.grpControls.ResumeLayout(false);
966 this.grpControls.PerformLayout();
967 this.tpaConnection.ResumeLayout(false);
968 this.tpaConnection.PerformLayout();
969 this.tpaOther.ResumeLayout(false);
970 this.tpaOther.PerformLayout();
971 ((System.ComponentModel.ISupportInitialize)(this.grdAsyncResult)).EndInit();
972 ((System.ComponentModel.ISupportInitialize)(this.nudEventPollingInterval)).EndInit();
973 this.grpPiece.ResumeLayout(false);
974 this.grpPiece.PerformLayout();
975 this.ResumeLayout(false);
976
977 }
978 #endregion
979
980 /// <summary>
981 /// The main entry point for the application.
982 /// </summary>
983 [STAThread]
984 static void Main()
985 {
986 try
987 {
988 Application.Run(new frmBMXNetTest());
989 return;
990 }
991 catch (Exception ex)
992 {
993 MessageBox.Show("BMXNetTest Error: " + ex.Message, "BMXNetTest", MessageBoxButtons.OK, MessageBoxIcon.Error);
994 return;
995 }
996
997 }
998
999 private BMXNetConnectInfo m_ci;
1000 private System.Windows.Forms.TabControl tabControl1;
1001 private System.Windows.Forms.DataGrid dataGrid2;
1002 private System.Windows.Forms.Button cmdCancelChanges;
1003 private System.Windows.Forms.TextBox txtCommand;
1004 private System.Windows.Forms.TextBox txtContext;
1005 private System.Windows.Forms.Button cmdChangeUser;
1006 private System.Windows.Forms.Button cmdChangeServer;
1007 private System.Windows.Forms.Button cmdChangeContext;
1008 private System.Windows.Forms.Button cmdChangeDivision;
1009 private System.Windows.Forms.TextBox txtDivision;
1010 private System.Windows.Forms.TextBox txtUser;
1011 private System.Windows.Forms.TextBox txtServer;
1012 private System.Windows.Forms.TabPage tpaQuery;
1013 private System.Windows.Forms.Panel panGrid;
1014 private System.Windows.Forms.Panel panQuery;
1015 private System.Windows.Forms.TabPage tpaConnection;
1016 private System.Windows.Forms.TabPage tpaOther;
1017 private System.Windows.Forms.GroupBox grpPiece;
1018 private System.Windows.Forms.TextBox txtDelim;
1019 private System.Windows.Forms.Label label7;
1020 private System.Windows.Forms.Label label6;
1021 private System.Windows.Forms.Label label5;
1022 private System.Windows.Forms.TextBox txtEnd;
1023 private System.Windows.Forms.TextBox txtResult;
1024 private System.Windows.Forms.TextBox txtNumber;
1025 private System.Windows.Forms.TextBox txtInput;
1026 private System.Windows.Forms.Button cmdTestPiece;
1027 private System.Windows.Forms.Button cmdTest4;
1028 private System.Windows.Forms.Button cmdTest3;
1029 private System.Windows.Forms.Button cmdExecuteQuery;
1030 private System.Windows.Forms.Button cmdAcceptChanges;
1031 private System.Windows.Forms.Button cmdXML;
1032 private System.Windows.Forms.GroupBox grpControls;
1033 private System.Windows.Forms.Button cmdCDLoad;
1034 private System.Windows.Forms.Label lblCDIntro;
1035 private System.Windows.Forms.Label label1;
1036 private System.Windows.Forms.TextBox txtCDName;
1037 private System.Windows.Forms.Label label2;
1038 private System.Windows.Forms.Label label3;
1039 private System.Windows.Forms.Label label8;
1040 private System.Windows.Forms.TextBox txtCDSex;
1041 private System.Windows.Forms.TextBox txtCDDOB;
1042 private System.Windows.Forms.TextBox txtCDSSN;
1043 private System.Windows.Forms.ComboBox cboCDSelect;
1044 private System.Windows.Forms.MonthCalendar calCDDOB;
1045 private System.Windows.Forms.TabPage tpaControls;
1046 private System.Windows.Forms.DateTimePicker dtpCDDOB;
1047 private System.Windows.Forms.Label label10;
1048 private System.Windows.Forms.Label label11;
1049 private System.Windows.Forms.Label label12;
1050 private System.Windows.Forms.ListBox lstCDSex;
1051 private System.Windows.Forms.Label label4;
1052 private System.Windows.Forms.Label label9;
1053 private System.Windows.Forms.Label label13;
1054 private System.Windows.Forms.Button cmdAddAll;
1055 private System.Windows.Forms.Button cmdUnregisterEvent;
1056 private System.Windows.Forms.TextBox txtUnregisterEvent;
1057 private System.Windows.Forms.Button cmdRaiseEvent;
1058 private System.Windows.Forms.TextBox txtRaiseEvent;
1059 private System.Windows.Forms.Button cmdRegisterEvent;
1060 private System.Windows.Forms.TextBox txtRegisterEvent;
1061 private System.Windows.Forms.Label label14;
1062 private System.Windows.Forms.Label label15;
1063 private System.Windows.Forms.TextBox txtEventParam;
1064 private System.Windows.Forms.CheckBox chkEventRaiseBack;
1065 private System.Windows.Forms.Button cmdAcquireLock;
1066 private System.Windows.Forms.Button cmdReleaseLock;
1067 private System.Windows.Forms.Button cmdEventPollingInterval;
1068 private System.Windows.Forms.NumericUpDown nudEventPollingInterval;
1069 private System.Windows.Forms.CheckBox chkEnableEvents;
1070 private System.Windows.Forms.Label label16;
1071 private System.Windows.Forms.TextBox txtEventMessages;
1072 private System.Windows.Forms.Label label17;
1073 private System.Windows.Forms.Button cmdAsyncCall;
1074 private System.Windows.Forms.TextBox txtAsyncCommand;
1075 private System.Windows.Forms.Label label18;
1076 private System.Windows.Forms.DataGrid grdAsyncResult;
1077 private System.Windows.Forms.Label label19;
1078 private Button cmdTestSilent;
1079 private Button cmdTestReceiveTimeout;
1080 private Button cmdStopLogging;
1081 private Button cmdStartLogging;
1082 BMXNetDataAdapter m_da = new BMXNetDataAdapter();
1083
1084
1085
1086 private void frmBMXNetTest_Load(object sender, System.EventArgs e)
1087 {
1088 //Basic steps to establish a BMXNet connection.
1089 //The first time a user connects, he will be prompted for
1090 //server info and passwords.
1091 //Subsequent connect requests will use cached information.
1092 //Note that LoadConnectInfo maintain's an internal copy
1093 //of a BMXNetLib object which is accessible from the
1094 //bmxNetLib property
1095 //
1096 //Use the ADO.NET provider methods or the BMXNetLib TransmitRPC
1097 //method to create a connection and exchange data.
1098 if (m_ci == null)
1099 m_ci = new BMXNetConnectInfo();
1100
1101 m_ci.EventPollingEnabled = false;
1102 m_ci.BMXNetEvent += new BMXNetConnectInfo.BMXNetEventDelegate(BMXNetEventHandler);
1103 try
1104 {
1105 //Use this overload to connect to the last M server
1106 //using Windows NT integrated security
1107 m_ci.LoadConnectInfo();
1108
1109 //Use the following overload to force prompt for AV codes.
1110 //You can also use this overload if
1111 // you want to create your own dialog to collect
1112 // AV codes. You may then pass
1113 // the values you collected to LoadConnectInfo(access,verify)
1114 //
1115 //m_ci.LoadConnectInfo("","");
1116
1117 m_ci.AppContext = "BMXRPC";
1118 txtContext.Text = m_ci.AppContext;
1119 this.txtServer.Text = m_ci.MServerAddress;
1120 this.txtUser.Text = m_ci.UserName;
1121 this.txtDivision.Text = m_ci.DivisionName;
1122
1123 }
1124 catch (Exception ex)
1125 {
1126 MessageBox.Show(ex.Message, "BMXNetTest");
1127 }
1128 txtCommand.Text = "BMX ADO SS^HW TEST^^~1~20~5";
1129 //txtCommand.Text = "SELECT NAME, AGE, DOB FROM PATIENT WHERE (NAME LIKE 'E%') AND (AGE BETWEEN 20 AND 60) MAXRECORDS:50";
1130// this.txtCommand.Text= "BMXGetFacRS^408";
1131// this.txtCommand.Text = "SELECT BMXIEN, NAME, AGE, DOB FROM VA_PATIENT WHERE (NAME LIKE 'E%') AND (AGE BETWEEN 20 AND 60) MAXRECORDS:50";
1132// txtCommand.Text = "BMX TEST^S|30";
1133// txtCommand.Text = "BMX ADO SS^IHS PATIENT^^~1~20~5";
1134// txtCommand.Text = "BMX ADO SS^17^^~4~4~5~~~~~18,SUB";
1135// //SIEN1,"","AA~3/21/1965~6/4/2004~5~~~~235|WT|C~11,.02"
1136// txtCommand.Text = "BMX ADO SS^23^^AA~3/21/1965~6/4/2004~5~~~~235|WT|C~11,.02";
1137// txtCommand.Text = "BMX ADO SS^17^^~4~9~~~~~~18,SUB";
1138// txtCommand.Text = "BMX ADO SS^11^^~1~5~~~~~~25,.001,.02IEN,AA~1/1/1960~6/30/2004~~~~~|C";
1139// txtCommand.Text = "BMX ADO SS^18^1,^~~~";
1140// txtCommand.Text = "BMX ADO SS^PATIENT DEMOGRAPHICS^^~1~5~";
1141// txtCommand.Text = @"BMX ADO SS^53^^~~~~~VMEAS~BMXADOFD~100002.1A||PU\60|WT\175|HT\70";
1142// txtCommand.Text = "BMX ADO SS^3^^~1658~1658^11,.05IEN,.001";
1143// BMX ADO SS^HW SD DEVICE1^^~~~
1144 }
1145
1146 private void cmdTestPiece_Click_1(object sender, System.EventArgs e)
1147 {
1148 //Demo of BMXNet Piece function. Note that only single-character
1149 //delimiters are supported.
1150 try
1151 {
1152 string sInput = txtInput.Text;
1153 string sDelim = txtDelim.Text;
1154 if (sDelim.Length > 1)
1155 throw new BMXNetException("BMXNet.Piece() supports only single-character delimiters.");
1156 int nNumber = Convert.ToInt16(txtNumber.Text);
1157 int nEnd = 0;
1158 string sOutput = "";
1159 if (txtEnd.Text != "")
1160 {
1161 nEnd = Convert.ToInt16(txtEnd.Text);
1162 sOutput = BMXNetLib.Piece(sInput, sDelim, nNumber, nEnd);
1163 }
1164 else
1165 {
1166 sOutput = BMXNetLib.Piece(sInput, sDelim, nNumber);
1167 }
1168
1169 txtResult.Text = sOutput;
1170 }
1171 catch (Exception ex)
1172 {
1173 MessageBox.Show(ex.Message, "BMXNetTest Error");
1174 }
1175 }
1176
1177 private void cmdTest3_Click(object sender, System.EventArgs e)
1178 {
1179 //How to create a low-level socket connection using
1180 //BMXNetLib and transmit a simple RPC.
1181
1182 //Always use try-catch blocks. BMXNet uses exceptions to report
1183 //errors and connection failures.
1184 try
1185 {
1186 BMXNetLib bnLib;
1187 bnLib = new BMXNetLib();
1188
1189 //Either collect your own connection information
1190 //or use the Windows Identity map to RPMS
1191 //and manually open a connection like this:
1192 //bnLib.MServerPort = nPort;
1193 //bnLib.OpenConnection(sIP, sAccess, sVerify);
1194 // -or-
1195 //bnLib.OpenConnection(sIP, WindowsIdentity.GetCurrent());
1196 //bnLib.AppContext = "BMXRPC";
1197 //If no exception thrown by OpenConnection, then connection
1198 //to rpms succeeded. If OpenConnection fails, then an exception
1199 //is thrown.
1200
1201 // -OR- Use BMXNetConnectInfo to establish connection
1202 //LoadConnectInfo will prompt for server and user info as needed
1203
1204 bnLib.MServerPort = m_ci.MServerPort;
1205 bnLib.OpenConnection("127.0.0.1",WindowsIdentity.GetCurrent());
1206// bnLib.OpenConnection("127.0.0.1","","");
1207 bnLib.AppContext = "BMXRPC";
1208
1209 string sDUZ = bnLib.DUZ;
1210 string sUser = bnLib.TransmitRPC("BMX USER", sDUZ);
1211 if (sUser.StartsWith("M ERROR=") == true)
1212 {
1213 Exception ex = new Exception(sUser);
1214 throw ex;
1215 }
1216 MessageBox.Show("Connection to RPMS succeeded. User name = " + sUser, "BMXNetLib Test");
1217 bnLib.CloseConnection();
1218 }
1219 catch (Exception ex)
1220 {
1221 MessageBox.Show(ex.Message, "BMXNetTest Error");
1222 }
1223
1224 }
1225
1226 private void cmdTest4_Click(object sender, System.EventArgs e)
1227 {
1228 /*Demo of retrieving multiple related tables,
1229 * joining them,
1230 * and attaching them to a grid that can
1231 * drill-down through the relations
1232 */
1233 try
1234 {
1235 if (m_ci.Connected == false)
1236 {
1237 throw new BMXNetException("Not connected to RPMS.");
1238 }
1239 frmVisitDemo frmVD = new frmVisitDemo();
1240 frmVD.InitializePage(m_ci);
1241 frmVD.ShowDialog(this);
1242 }
1243 catch (Exception ex)
1244 {
1245 MessageBox.Show(ex.Message, "BMXNetTest Error");
1246 }
1247
1248 }
1249
1250 private void cmdChangeServer_Click(object sender, System.EventArgs e)
1251 {
1252 //How to change the RPMS server in BMXNetConnectInfo
1253 try
1254 {
1255 m_ci.ChangeServerInfo();
1256 m_ci.LoadConnectInfo();
1257 }
1258 catch (Exception ex)
1259 {
1260 MessageBox.Show(ex.Message, "BMXNetTest");
1261 }
1262
1263 }
1264
1265 private void cmdChangeUser_Click(object sender, System.EventArgs e)
1266 {
1267 //How to change the RPMS user
1268 try
1269 {
1270 m_ci.LoadConnectInfo("","");
1271 m_ci.AppContext = "BMXRPC";
1272 MessageBox.Show("User changed to " + m_ci.UserName + " on Server " + m_ci.MServerAddress + ", on Port " + m_ci.MServerPort);
1273 }
1274 catch (Exception ex)
1275 {
1276 MessageBox.Show(ex.Message, "BMXNetTest");
1277 }
1278 }
1279
1280 private void cmdCancelChanges_Click(object sender, System.EventArgs e)
1281 {
1282 DataTable dt = (DataTable) dataGrid2.DataSource;
1283 dt.RejectChanges();
1284 }
1285
1286 private void cmdChangeContext_Click(object sender, System.EventArgs e)
1287 {
1288 try
1289 {
1290 m_ci.AppContext = txtContext.Text;
1291 MessageBox.Show("Context changed to " + m_ci.AppContext);
1292 }
1293 catch (Exception ex)
1294 {
1295 MessageBox.Show(ex.Message);
1296 }
1297 }
1298
1299 private void cmdChangeDivision_Click(object sender, System.EventArgs e)
1300 {
1301
1302 /*How to change user division:
1303 * You can either create your own dialog, populate
1304 * it with using the UserDivisions datatable and DUZ2 string
1305 * from ConnectInfo
1306 * and then manually reset ConnectInfo's DUZ2 property,
1307 * -OR-
1308 * you can invoke ConnectInfo's ChangeDivision method
1309 * which will display its own dialog for you. The
1310 * commented code below shows the 'manual' way (you will have to
1311 * first create a 'DSelectDivision' dialog class)
1312 */
1313
1314 if (m_ci.Connected == false)
1315 {
1316 throw new BMXNetException("Not connected to RPMS.");
1317 }
1318
1319// DSelectDivision dsd = new DSelectDivision();
1320// dsd.InitializePage(m_ci.UserDivisions, m_ci.DUZ2);
1321// if (dsd.ShowDialog(this) == DialogResult.Cancel)
1322// return;
1323// m_ci.DUZ2 = dsd.DUZ2;
1324
1325 m_ci.ChangeDivision(this);
1326 this.txtDivision.Text = m_ci.DivisionName;
1327 }
1328
1329 private void cmdExecuteQuery_Click(object sender, System.EventArgs e)
1330 {
1331 //This is the 'Execute' button on the form and demonstrates
1332 //how to use the BMXNet ADO.NET Data Provider to
1333 //retrieve an RPMS ADO.NET datatable.
1334 MessageBox.Show("TEST");
1335 try
1336 {
1337 if (m_ci.Connected == false)
1338 {
1339 throw new Exception("Not connected to RPMS.");
1340 }
1341 //m_ci.bmxNetLib.StartLog("TestLog.txt");
1342 //m_ci.bmxNetLib.StartLog();
1343 m_ci.bmxNetLib.BMXRWL.AcquireWriterLock(5);
1344 dataGrid2.DataSource = m_ci.RPMSDataTable(txtCommand.Text, "SampleTable");
1345 }
1346 catch (Exception ex)
1347 {
1348 MessageBox.Show(ex.Message);
1349 return;
1350 }
1351 finally
1352 {
1353 if (m_ci.bmxNetLib.BMXRWL.IsWriterLockHeld == true)
1354 {
1355 m_ci.bmxNetLib.BMXRWL.ReleaseWriterLock();
1356 }
1357 //m_ci.bmxNetLib.StopLog();
1358
1359 }
1360 }
1361
1362 /// <summary>
1363 /// How to Accept Updates to an updateable recordset
1364 /// using the BMXNetDataAdapter's Update method
1365 /// </summary>
1366 /// <param name="sender"></param>
1367 /// <param name="e"></param>
1368 private void cmdAcceptChanges_Click(object sender, System.EventArgs e)
1369 {
1370 int nTimeOut = m_ci.ReceiveTimeout;
1371 try
1372 {
1373 m_ci.ReceiveTimeout = (90 * 1000);
1374 DataTable dtPrimary = (DataTable)dataGrid2.DataSource;
1375 DataSet ds = dtPrimary.DataSet;
1376 if ((dtPrimary.DataSet is DataSet) == false)
1377 {
1378 ds = new DataSet();
1379 ds.Tables.Add(dtPrimary);
1380 }
1381 foreach (DataTable dt in ds.Tables)
1382 {
1383 BMXNetConnection conn = new BMXNetConnection(m_ci.bmxNetLib);
1384 DataTable dtc = dt.GetChanges();
1385 if (dtc != null)
1386 {
1387
1388 BMXNetCommand bmxSelectCmd = (BMXNetCommand)conn.CreateCommand();
1389 bmxSelectCmd.CommandText = txtCommand.Text;
1390 m_da.SelectCommand = bmxSelectCmd;
1391
1392 DataTable dtSchema = m_da.FillSchema(dtc, SchemaType.Source);
1393
1394 //Build UPDATE command based on info stored in table's extended property set
1395 BMXNetCommand bmxUpdateCmd = new BMXNetCommand();
1396 bmxUpdateCmd.Connection = conn;
1397
1398 //Call BMXBuildUpdateCommand(dtSchema) to set up parameters
1399 bmxUpdateCmd.BMXBuildUpdateCommand(dtSchema);
1400
1401 //Link command to data adapeter
1402 m_da.UpdateCommand = bmxUpdateCmd;
1403
1404 //Call adapter's Update method
1405 m_da.Update(dtc);
1406
1407 //Accept the changes to the datagrid's datatable
1408 dt.AcceptChanges();
1409 }
1410 }
1411 }
1412 catch (Exception ex)
1413 {
1414 MessageBox.Show(ex.Message);
1415 }
1416 finally
1417 {
1418 m_ci.ReceiveTimeout = nTimeOut;
1419 }
1420 }
1421
1422 private void dataGrid2_Navigate(object sender, System.Windows.Forms.NavigateEventArgs ne)
1423 {
1424 string sDirection = (ne.Forward == true)?"forward":"backward";
1425 string myString = "Navigate event raised, moved " + sDirection;
1426 Debug.Write(myString + "\n");
1427
1428 }
1429
1430 private void cmdXML_Click(object sender, System.EventArgs e)
1431 {
1432 //Writes contents of the datagrid's current dataset to XML file
1433 //Also writes dataset structure to XSD schema file
1434 //Transforms the datetime data in the XML file to a format acceptable to
1435 // MS Excel by removing the UTC time conversion info from the end of the datetime string
1436 try
1437 {
1438 DataTable dtPrimary = (DataTable)dataGrid2.DataSource;
1439 DataSet ds = dtPrimary.DataSet;
1440
1441 if ((dtPrimary.DataSet is DataSet) == false)
1442 {
1443 ds = new DataSet();
1444 ds.Tables.Add(dtPrimary);
1445 }
1446
1447 SaveFileDialog saveFileDialog1 = new SaveFileDialog();
1448 saveFileDialog1.Filter = "XML Files (*.xml)|*.xml|All files (*.*)|*.*";
1449 saveFileDialog1.FilterIndex = 0;
1450 saveFileDialog1.RestoreDirectory = true;
1451 saveFileDialog1.AddExtension = true;
1452 saveFileDialog1.DefaultExt = "xml";
1453
1454 if (saveFileDialog1.ShowDialog() != DialogResult.OK)
1455 {
1456 return;
1457 }
1458
1459 //create file names based on user input.
1460 //sFile = the name of the XML file created by the dataset export
1461 //sSchemaFile = the schema generated by the dataset
1462 //xXSL file = the transform file applied to sFile
1463 //sFileOut = the final transformed XML file
1464 string sFile = saveFileDialog1.FileName;
1465 string sSchemaFile = sFile.Remove(sFile.Length - 4, 4);
1466 sSchemaFile = sSchemaFile + "Schema.xsd";
1467 string sFileOut = sFile;
1468 sFile = sFile.Remove(sFile.Length - 4, 4);
1469 sFile = sFile + "Input.xml";
1470 string sXSLFile = sSchemaFile.Remove(sSchemaFile.Length - 10, 10);
1471 sXSLFile = sXSLFile + "Transform.xslt";
1472
1473 // Open file to which to write schema
1474 System.IO.FileStream fsSchema = new System.IO.FileStream
1475 (sSchemaFile, System.IO.FileMode.Create);
1476 System.Xml.XmlTextWriter schemaWriter =
1477 new System.Xml.XmlTextWriter(fsSchema, System.Text.Encoding.ASCII);
1478 ds.WriteXmlSchema(schemaWriter);
1479 schemaWriter.Close();
1480
1481 // Write out the dataset to xml
1482 System.IO.FileStream myFileStream = new System.IO.FileStream
1483 (sFile, System.IO.FileMode.Create);
1484 System.Xml.XmlTextWriter myXmlWriter =
1485 new System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.ASCII);
1486 ds.WriteXml(myXmlWriter);
1487 myXmlWriter.Close();
1488
1489 //Create and apply an xslt file to reformat dates to be Excel compatible
1490 //First create the xslt transform
1491 this.CreateXSL(sSchemaFile, sXSLFile);
1492 //Apply the transform
1493 System.Xml.XmlResolver xmlr = null;
1494 XslTransform xslt = new XslTransform();
1495 //System.Xml.Xsl.XslCompiledTransform xslt = new XslCompiledTransform();
1496 try
1497 {
1498 xslt.Load(sXSLFile, xmlr);
1499 //xslt.Load(sXSLFile, null , xmlr);
1500
1501 xslt.Transform(sFile, sFileOut, xmlr);
1502 //xslt.Transform(
1503 }
1504 catch (Exception ex)
1505 {
1506 MessageBox.Show(ex.Message);
1507 }
1508 }
1509 catch (Exception ex)
1510 {
1511 MessageBox.Show(ex.Message);
1512 }
1513 }
1514
1515 private void CreateXSL(string sXsdFile, string sXsltFile)
1516 {
1517 //Given an xsd file, create an xsl transform to apply to xlm file
1518 //that will transform xml date format to Excel dates by removing UTC information
1519 //from the xml datetime value.
1520
1521 //Open the xsd input file and xsl output file
1522 //and associate with XML reader and writer
1523
1524 string sFileIn = sXsdFile;
1525 string sFileOut = sXsltFile;
1526
1527 //Open XMLTextWriter
1528 System.IO.FileStream fsOut = new System.IO.FileStream
1529 (sFileOut, System.IO.FileMode.Create);
1530 System.Xml.XmlTextWriter xwOut =
1531 new System.Xml.XmlTextWriter(fsOut, System.Text.Encoding.ASCII);
1532
1533 //Write to the output file
1534 xwOut.Formatting=Formatting.Indented;
1535
1536 xwOut.WriteStartElement("xsl", "stylesheet", "http://www.w3.org/1999/XSL/Transform");
1537 xwOut.WriteAttributeString("xmlns","msxsl",null, "urn:schemas-microsoft-com:xslt");
1538 xwOut.WriteAttributeString("xmlns","bmx",null, "http://bmx.ihs.gov");
1539 xwOut.WriteAttributeString("version", "1.0");
1540
1541 xwOut.WriteStartElement( "msxsl", "script", null);
1542 xwOut.WriteAttributeString("implements-prefix", "bmx");
1543 xwOut.WriteAttributeString("language", "C#");
1544
1545 string sCode = "\npublic string ExcelDate(string sXMLDate) {\n";
1546 sCode += "string sConverted;\n";
1547 sCode += "sConverted = sXMLDate.Remove(sXMLDate.Length - 15,15);\n";
1548 sCode += "return sConverted;\n";
1549 sCode += "}\n";
1550 xwOut.WriteCData(sCode);
1551 xwOut.WriteFullEndElement(); //msxsl script
1552
1553 xwOut.WriteStartElement("xsl", "output", null);
1554 xwOut.WriteAttributeString("method", "xml");
1555 xwOut.WriteAttributeString("indent", "yes");
1556 xwOut.WriteEndElement();
1557
1558 xwOut.WriteStartElement("xsl", "template", null);
1559 xwOut.WriteAttributeString("match", "@*|node()");
1560 xwOut.WriteStartElement("xsl", "copy", null);
1561 xwOut.WriteStartElement("xsl", "apply-templates", null);
1562 xwOut.WriteAttributeString("select", "@*|node()");
1563 xwOut.WriteEndElement(); //apply templates
1564 xwOut.WriteFullEndElement(); //copy
1565 xwOut.WriteFullEndElement(); //template
1566
1567 ArrayList alFieldNames = new ArrayList();
1568
1569 //read from schema file
1570 //Open XMLTextReader
1571 System.IO.FileStream fsIn = new System.IO.FileStream
1572 (sFileIn, System.IO.FileMode.Open);
1573 System.Xml.XmlTextReader xrIn =
1574 new System.Xml.XmlTextReader(fsIn);
1575
1576 string sFieldName = "";
1577 while (xrIn.Read())
1578 {
1579 if (xrIn.NodeType == XmlNodeType.Element)
1580 {
1581 switch (xrIn.LocalName)
1582 {
1583 case "element":
1584 if (xrIn.MoveToAttribute("name"))
1585 {
1586 sFieldName = xrIn.Value;
1587 if (xrIn.MoveToAttribute("type"))
1588 {
1589 if (xrIn.Value == "xs:dateTime")
1590 {
1591 alFieldNames.Add(sFieldName);
1592 }
1593 }
1594 }
1595 else
1596 {
1597 xrIn.Skip();
1598 }
1599 break;
1600 }//switch
1601 }//if
1602 }//while
1603
1604 //build conversion templates
1605 for (int j=0; j < alFieldNames.Count; j++)
1606 {
1607 sFieldName = alFieldNames[j].ToString();
1608 xwOut.WriteStartElement("xsl", "template", null);
1609 xwOut.WriteAttributeString("match", sFieldName);
1610
1611 xwOut.WriteStartElement("xsl", "element", null);
1612 xwOut.WriteAttributeString("name", sFieldName);
1613
1614 xwOut.WriteStartElement("xsl", "value-of", null);
1615 xwOut.WriteAttributeString("select", "bmx:ExcelDate(.)");
1616
1617 xwOut.WriteEndElement(); //value-of
1618 xwOut.WriteFullEndElement(); //element
1619 xwOut.WriteFullEndElement(); //template
1620 }
1621
1622 xwOut.WriteFullEndElement(); //stylesheet
1623 xwOut.Close();
1624 }
1625
1626 /*
1627 * Controls Demo
1628 * Demonstrates how to populate controls from a datatable
1629 */
1630 private void cmdCDLoad_Click(object sender, System.EventArgs e)
1631 {
1632 try
1633 {
1634 if (m_ci.Connected == false)
1635 {
1636 throw new BMXNetException("Not connected to RPMS.");
1637 }
1638
1639 string sCommandText = "BMX ADO SS^PATIENT DEMOGRAPHICS^^~1~50~";
1640 DataTable dt = m_ci.RPMSDataTable(sCommandText, "ControlsDemo");
1641
1642 txtCDName.DataBindings.Clear();
1643 txtCDSex.DataBindings.Clear();
1644 txtCDDOB.DataBindings.Clear();
1645 txtCDSSN.DataBindings.Clear();
1646 calCDDOB.DataBindings.Clear();
1647 dtpCDDOB.DataBindings.Clear();
1648 lstCDSex.DataBindings.Clear();
1649
1650 DataView dvCDPat = new DataView(dt);
1651 dvCDPat.Sort = "NAME ASC";
1652
1653 cboCDSelect.DataSource = dvCDPat;
1654 cboCDSelect.DisplayMember = "NAME";
1655 cboCDSelect.ValueMember = "BMXIEN";
1656
1657 txtCDName.DataBindings.Add("Text", dvCDPat, "NAME");
1658 txtCDSex.DataBindings.Add("Text", dvCDPat, "SEX");
1659 txtCDDOB.DataBindings.Add("Text", dvCDPat, "DOB");
1660 txtCDSSN.DataBindings.Add("Text", dvCDPat, "SSN");
1661
1662 calCDDOB.DataBindings.Add("SelectionStart", dvCDPat, "DOB");
1663 calCDDOB.DataBindings.Add("SelectionEnd", dvCDPat, "DOB");
1664
1665 dtpCDDOB.DataBindings.Add("Value", dvCDPat, "DOB");
1666
1667 lstCDSex.DataBindings.Add("SelectedItem", dvCDPat, "SEX");
1668
1669 }
1670 catch (Exception ex)
1671 {
1672 MessageBox.Show(ex.Message);
1673 return;
1674 }
1675 }
1676
1677 private void cmdAddAll_Click(object sender, System.EventArgs e)
1678 {
1679 /*
1680 * How to Accept Updates to an updateable recordset
1681 * using the new schema format and the data adapter's Update method
1682 */
1683
1684 try
1685 {
1686 DataTable dtPrimary = (DataTable) dataGrid2.DataSource;
1687 DataSet ds = dtPrimary.DataSet;
1688
1689
1690
1691 foreach (DataTable dt in ds.Tables)
1692 {
1693
1694 BMXNetConnection conn = new BMXNetConnection(m_ci.bmxNetLib);
1695
1696 object[] oVal = new object[dt.Columns.Count];
1697 //Call adapter's Update method
1698 int nRowCount = dt.Rows.Count;
1699 for (int j=0; j < nRowCount; j++ )
1700 {
1701 DataRow r = dt.Rows[j];
1702 for (int k = 0; k < dt.Columns.Count; k++)
1703 {
1704 oVal[k] = r[dt.Columns[k].ColumnName];
1705 }
1706 DataRow rAdd = dt.Rows.Add(oVal);
1707 }
1708
1709 DataTable dtc = dt.GetChanges();
1710 if (dtc != null)
1711 {
1712 DataTable dtSchema = m_da.FillSchema(dtc, SchemaType.Source);
1713
1714 //Build UPDATE command based on info stored in table's extended property set
1715 BMXNetCommand bmxUpdateCmd = new BMXNetCommand();
1716 bmxUpdateCmd.Connection = conn;
1717
1718 //Call BMXBuildUpdateCommand(dtSchema) to set up parameters
1719 bmxUpdateCmd.BMXBuildUpdateCommand(dtSchema);
1720
1721 //Link command to data adapter
1722 m_da.UpdateCommand = bmxUpdateCmd;
1723
1724 //Call adapter's Update method
1725 m_da.Update(dtc);
1726
1727 //Accept the changes to the datagrid's datatable
1728 dt.RejectChanges();
1729 }
1730 }
1731 }
1732 catch (Exception ex)
1733 {
1734 MessageBox.Show(ex.Message);
1735 }
1736 }
1737
1738 #region Event Handling and Asynchronous Calls
1739
1740 private string m_sTask;
1741 private void cmdAsyncCall_Click(object sender, System.EventArgs e)
1742 {
1743 try
1744 {
1745 //Use the windows handle to create a unique event name
1746 Process pCurrent = Process.GetCurrentProcess();
1747 string sID = Environment.MachineName + "-";
1748 sID += pCurrent.Id.ToString();
1749 m_ci.SubscribeEvent("BMX ASYNC RESULT READY" + sID ); // this.Handle.ToString());
1750 //nTask corresponds to TaskMan's ZTSK
1751 int nTask = m_ci.RPMSDataTableAsyncQue(this.txtAsyncCommand.Text, "BMX ASYNC RESULT READY" + sID) ;//this.Handle.ToString());
1752 //Save ZTSK for later comparison
1753 m_sTask = nTask.ToString();
1754 }
1755 catch (Exception ex)
1756 {
1757 MessageBox.Show(ex.Message);
1758 }
1759 }
1760
1761 private void BMXNetEventHandler(Object obj, BMXNet.BMXNetEventArgs e)
1762 {
1763 try
1764 {
1765 //BMXNet events arrive on a separate thread from the UI thread,
1766 //thus UI methods should be called using BeginInvoke or Invoke
1767 UpdateEventMessageTextDelegate dlgUEMT = new UpdateEventMessageTextDelegate(UpdateEventMessageText);
1768 this.Invoke(dlgUEMT, new object[] {e.BMXEvent, e.BMXParam});
1769
1770 Process pCurrent = Process.GetCurrentProcess();
1771 string sID = Environment.MachineName + "-";
1772 sID += pCurrent.Id.ToString();
1773 if (e.BMXEvent == "BMX ASYNC RESULT READY" + sID)
1774 {
1775 string sTask = BMXNetLib.Piece(e.BMXParam, "~", 1);
1776 string sAsyncInfo = BMXNetLib.Piece(e.BMXParam,"~",2);
1777 DataTable dtAsyncGrid = m_ci.RPMSDataTableAsyncGet(sAsyncInfo, "AsyncData");
1778 UpdateAsyncGridDelegate uagd = new UpdateAsyncGridDelegate(UpdateAsyncGrid);
1779 this.BeginInvoke(uagd, new object[] {sTask, dtAsyncGrid});
1780 }
1781 }
1782 catch (Exception ex)
1783 {
1784 Debug.Write("BMXNetEventHandler exception: " + ex.Message + "\n");
1785 }
1786 }
1787
1788 delegate void UpdateAsyncGridDelegate(string sTask, DataTable dt);
1789 private void UpdateAsyncGrid(string sTask, DataTable dt)
1790 {
1791 try
1792 {
1793 //Assert that invoke is not required in any UI method that may be called
1794 //by a worker thread (e.g. from an event)
1795 Debug.Assert(this.InvokeRequired == false);
1796
1797 //Check that this is the same job that we tasked
1798 if (m_sTask != sTask)
1799 return;
1800
1801 grdAsyncResult.DataSource = dt;
1802 m_ci.UnSubscribeEvent("BMX ASYNC RESULT READY" + this.Handle.ToString());
1803 }
1804 catch (Exception ex)
1805 {
1806 Debug.Write("UpdateAsyncGrid exception: " + ex.Message + "\n");
1807 }
1808 }
1809
1810 delegate void UpdateEventMessageTextDelegate(string EventName, string Param);
1811
1812 private void UpdateEventMessageText(string EventName, string Param)
1813 {
1814 Debug.Assert(this.InvokeRequired == false);
1815 txtEventMessages.Text = "BMXNet event " + EventName + " fired with parameter " + Param;
1816 if (txtEventMessages.BackColor == System.Drawing.Color.LightGreen)
1817 {
1818 txtEventMessages.BackColor = System.Drawing.Color.LightCoral;
1819 }
1820 else
1821 {
1822 txtEventMessages.BackColor = System.Drawing.Color.LightGreen;
1823 }
1824 }
1825
1826 private void cmdRegisterEvent_Click(object sender, System.EventArgs e)
1827 {
1828 m_ci.SubscribeEvent(this.txtRegisterEvent.Text);
1829 }
1830
1831 private void cmdUnregisterEvent_Click(object sender, System.EventArgs e)
1832 {
1833 m_ci.UnSubscribeEvent(this.txtUnregisterEvent.Text);
1834 }
1835
1836 private void cmdRaiseEvent_Click(object sender, System.EventArgs e)
1837 {
1838 m_ci.RaiseEvent(this.txtRaiseEvent.Text, txtEventParam.Text, chkEventRaiseBack.Checked);
1839 }
1840
1841 private void cmdAcquireLock_Click(object sender, System.EventArgs e)
1842 {
1843 try
1844 {
1845 m_ci.bmxNetLib.BMXRWL.AcquireWriterLock(5);
1846 }
1847 catch (Exception ex)
1848 {
1849 MessageBox.Show(ex.Message);
1850 }
1851 }
1852
1853 private void cmdReleaseLock_Click(object sender, System.EventArgs e)
1854 {
1855 try
1856 {
1857 m_ci.bmxNetLib.BMXRWL.ReleaseWriterLock();
1858 }
1859 catch (Exception ex)
1860 {
1861 MessageBox.Show(ex.Message);
1862 }
1863 }
1864
1865 private void chkEnableEvents_CheckedChanged(object sender, System.EventArgs e)
1866 {
1867 m_ci.EventPollingInterval = Convert.ToInt16(nudEventPollingInterval.Value);
1868 m_ci.EventPollingEnabled = chkEnableEvents.Checked;
1869 }
1870
1871 private void nudEventPollingInterval_ValueChanged(object sender, System.EventArgs e)
1872 {
1873 m_ci.EventPollingInterval = Convert.ToInt16(nudEventPollingInterval.Value);
1874 }
1875
1876 #endregion Event Handling
1877
1878 private void cmdTestSilent_Click(object sender, EventArgs e)
1879 {
1880 try
1881 {
1882 this.m_ci.CloseConnection();
1883
1884 string sA = "";
1885 string sV = "";
1886 string sAddress = "";
1887 int nPort = 10501;
1888 string sN = "";
1889
1890 m_ci.LoadConnectInfo(sAddress, nPort, sA, sV, sN);
1891 }
1892 catch (Exception ex)
1893 {
1894 MessageBox.Show(ex.Message);
1895 }
1896
1897 }
1898
1899 private void cmdTestReceiveTimeout_Click(object sender, EventArgs e)
1900 {
1901 int nTest = 5000;
1902 this.m_ci.ReceiveTimeout = nTest;
1903 }
1904
1905 private void cmdStartLogging_Click(object sender, EventArgs e)
1906 {
1907 try
1908 {
1909 m_ci.bmxNetLib.StartLog();
1910 }
1911 catch (Exception ex)
1912 {
1913 MessageBox.Show("Unable to start logging: " + ex.Message);
1914 }
1915 }
1916
1917 private void cmdStopLogging_Click(object sender, EventArgs e)
1918 {
1919 try
1920 {
1921 m_ci.bmxNetLib.StopLog();
1922 }
1923 catch (Exception ex)
1924 {
1925 MessageBox.Show("Unable to stop logging: " + ex.Message);
1926 }
1927 }
1928
1929
1930
1931 }
1932}
Note: See TracBrowser for help on using the repository browser.