source: BMXNET_RPMS_dotNET_UTILITIES-BMX/trunk/cs/bmx_0200scr/BMX2/BMXNetTest/frmBMXNetTest.cs@ 818

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

Some profiling code in BMXNetLib.cs conditional on #DEBUG.

File size: 78.5 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("192.168.1.103",9260,"","");
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 try
1335 {
1336 if (m_ci.Connected == false)
1337 {
1338 throw new Exception("Not connected to RPMS.");
1339 }
1340 //m_ci.bmxNetLib.StartLog("TestLog.txt");
1341 //m_ci.bmxNetLib.StartLog();
1342 m_ci.bmxNetLib.BMXRWL.AcquireWriterLock(5);
1343 dataGrid2.DataSource = m_ci.RPMSDataTable(txtCommand.Text, "SampleTable");
1344 }
1345 catch (Exception ex)
1346 {
1347 MessageBox.Show(ex.Message);
1348 return;
1349 }
1350 finally
1351 {
1352 if (m_ci.bmxNetLib.BMXRWL.IsWriterLockHeld == true)
1353 {
1354 m_ci.bmxNetLib.BMXRWL.ReleaseWriterLock();
1355 }
1356 //m_ci.bmxNetLib.StopLog();
1357
1358 }
1359 }
1360
1361 /// <summary>
1362 /// How to Accept Updates to an updateable recordset
1363 /// using the BMXNetDataAdapter's Update method
1364 /// </summary>
1365 /// <param name="sender"></param>
1366 /// <param name="e"></param>
1367 private void cmdAcceptChanges_Click(object sender, System.EventArgs e)
1368 {
1369 int nTimeOut = m_ci.ReceiveTimeout;
1370 try
1371 {
1372 m_ci.ReceiveTimeout = (90 * 1000);
1373 DataTable dtPrimary = (DataTable)dataGrid2.DataSource;
1374 DataSet ds = dtPrimary.DataSet;
1375 if ((dtPrimary.DataSet is DataSet) == false)
1376 {
1377 ds = new DataSet();
1378 ds.Tables.Add(dtPrimary);
1379 }
1380 foreach (DataTable dt in ds.Tables)
1381 {
1382 BMXNetConnection conn = new BMXNetConnection(m_ci.bmxNetLib);
1383 DataTable dtc = dt.GetChanges();
1384 if (dtc != null)
1385 {
1386
1387 BMXNetCommand bmxSelectCmd = (BMXNetCommand)conn.CreateCommand();
1388 bmxSelectCmd.CommandText = txtCommand.Text;
1389 m_da.SelectCommand = bmxSelectCmd;
1390
1391 DataTable dtSchema = m_da.FillSchema(dtc, SchemaType.Source);
1392
1393 //Build UPDATE command based on info stored in table's extended property set
1394 BMXNetCommand bmxUpdateCmd = new BMXNetCommand();
1395 bmxUpdateCmd.Connection = conn;
1396
1397 //Call BMXBuildUpdateCommand(dtSchema) to set up parameters
1398 bmxUpdateCmd.BMXBuildUpdateCommand(dtSchema);
1399
1400 //Link command to data adapeter
1401 m_da.UpdateCommand = bmxUpdateCmd;
1402
1403 //Call adapter's Update method
1404 m_da.Update(dtc);
1405
1406 //Accept the changes to the datagrid's datatable
1407 dt.AcceptChanges();
1408 }
1409 }
1410 }
1411 catch (Exception ex)
1412 {
1413 MessageBox.Show(ex.Message);
1414 }
1415 finally
1416 {
1417 m_ci.ReceiveTimeout = nTimeOut;
1418 }
1419 }
1420
1421 private void dataGrid2_Navigate(object sender, System.Windows.Forms.NavigateEventArgs ne)
1422 {
1423 string sDirection = (ne.Forward == true)?"forward":"backward";
1424 string myString = "Navigate event raised, moved " + sDirection;
1425 Debug.Write(myString + "\n");
1426
1427 }
1428
1429 private void cmdXML_Click(object sender, System.EventArgs e)
1430 {
1431 //Writes contents of the datagrid's current dataset to XML file
1432 //Also writes dataset structure to XSD schema file
1433 //Transforms the datetime data in the XML file to a format acceptable to
1434 // MS Excel by removing the UTC time conversion info from the end of the datetime string
1435 try
1436 {
1437 DataTable dtPrimary = (DataTable)dataGrid2.DataSource;
1438 DataSet ds = dtPrimary.DataSet;
1439
1440 if ((dtPrimary.DataSet is DataSet) == false)
1441 {
1442 ds = new DataSet();
1443 ds.Tables.Add(dtPrimary);
1444 }
1445
1446 SaveFileDialog saveFileDialog1 = new SaveFileDialog();
1447 saveFileDialog1.Filter = "XML Files (*.xml)|*.xml|All files (*.*)|*.*";
1448 saveFileDialog1.FilterIndex = 0;
1449 saveFileDialog1.RestoreDirectory = true;
1450 saveFileDialog1.AddExtension = true;
1451 saveFileDialog1.DefaultExt = "xml";
1452
1453 if (saveFileDialog1.ShowDialog() != DialogResult.OK)
1454 {
1455 return;
1456 }
1457
1458 //create file names based on user input.
1459 //sFile = the name of the XML file created by the dataset export
1460 //sSchemaFile = the schema generated by the dataset
1461 //xXSL file = the transform file applied to sFile
1462 //sFileOut = the final transformed XML file
1463 string sFile = saveFileDialog1.FileName;
1464 string sSchemaFile = sFile.Remove(sFile.Length - 4, 4);
1465 sSchemaFile = sSchemaFile + "Schema.xsd";
1466 string sFileOut = sFile;
1467 sFile = sFile.Remove(sFile.Length - 4, 4);
1468 sFile = sFile + "Input.xml";
1469 string sXSLFile = sSchemaFile.Remove(sSchemaFile.Length - 10, 10);
1470 sXSLFile = sXSLFile + "Transform.xslt";
1471
1472 // Open file to which to write schema
1473 System.IO.FileStream fsSchema = new System.IO.FileStream
1474 (sSchemaFile, System.IO.FileMode.Create);
1475 System.Xml.XmlTextWriter schemaWriter =
1476 new System.Xml.XmlTextWriter(fsSchema, System.Text.Encoding.ASCII);
1477 ds.WriteXmlSchema(schemaWriter);
1478 schemaWriter.Close();
1479
1480 // Write out the dataset to xml
1481 System.IO.FileStream myFileStream = new System.IO.FileStream
1482 (sFile, System.IO.FileMode.Create);
1483 System.Xml.XmlTextWriter myXmlWriter =
1484 new System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.ASCII);
1485 ds.WriteXml(myXmlWriter);
1486 myXmlWriter.Close();
1487
1488 //Create and apply an xslt file to reformat dates to be Excel compatible
1489 //First create the xslt transform
1490 this.CreateXSL(sSchemaFile, sXSLFile);
1491 //Apply the transform
1492 System.Xml.XmlResolver xmlr = null;
1493 XslTransform xslt = new XslTransform();
1494 //System.Xml.Xsl.XslCompiledTransform xslt = new XslCompiledTransform();
1495 try
1496 {
1497 xslt.Load(sXSLFile, xmlr);
1498 //xslt.Load(sXSLFile, null , xmlr);
1499
1500 xslt.Transform(sFile, sFileOut, xmlr);
1501 //xslt.Transform(
1502 }
1503 catch (Exception ex)
1504 {
1505 MessageBox.Show(ex.Message);
1506 }
1507 }
1508 catch (Exception ex)
1509 {
1510 MessageBox.Show(ex.Message);
1511 }
1512 }
1513
1514 private void CreateXSL(string sXsdFile, string sXsltFile)
1515 {
1516 //Given an xsd file, create an xsl transform to apply to xlm file
1517 //that will transform xml date format to Excel dates by removing UTC information
1518 //from the xml datetime value.
1519
1520 //Open the xsd input file and xsl output file
1521 //and associate with XML reader and writer
1522
1523 string sFileIn = sXsdFile;
1524 string sFileOut = sXsltFile;
1525
1526 //Open XMLTextWriter
1527 System.IO.FileStream fsOut = new System.IO.FileStream
1528 (sFileOut, System.IO.FileMode.Create);
1529 System.Xml.XmlTextWriter xwOut =
1530 new System.Xml.XmlTextWriter(fsOut, System.Text.Encoding.ASCII);
1531
1532 //Write to the output file
1533 xwOut.Formatting=Formatting.Indented;
1534
1535 xwOut.WriteStartElement("xsl", "stylesheet", "http://www.w3.org/1999/XSL/Transform");
1536 xwOut.WriteAttributeString("xmlns","msxsl",null, "urn:schemas-microsoft-com:xslt");
1537 xwOut.WriteAttributeString("xmlns","bmx",null, "http://bmx.ihs.gov");
1538 xwOut.WriteAttributeString("version", "1.0");
1539
1540 xwOut.WriteStartElement( "msxsl", "script", null);
1541 xwOut.WriteAttributeString("implements-prefix", "bmx");
1542 xwOut.WriteAttributeString("language", "C#");
1543
1544 string sCode = "\npublic string ExcelDate(string sXMLDate) {\n";
1545 sCode += "string sConverted;\n";
1546 sCode += "sConverted = sXMLDate.Remove(sXMLDate.Length - 15,15);\n";
1547 sCode += "return sConverted;\n";
1548 sCode += "}\n";
1549 xwOut.WriteCData(sCode);
1550 xwOut.WriteFullEndElement(); //msxsl script
1551
1552 xwOut.WriteStartElement("xsl", "output", null);
1553 xwOut.WriteAttributeString("method", "xml");
1554 xwOut.WriteAttributeString("indent", "yes");
1555 xwOut.WriteEndElement();
1556
1557 xwOut.WriteStartElement("xsl", "template", null);
1558 xwOut.WriteAttributeString("match", "@*|node()");
1559 xwOut.WriteStartElement("xsl", "copy", null);
1560 xwOut.WriteStartElement("xsl", "apply-templates", null);
1561 xwOut.WriteAttributeString("select", "@*|node()");
1562 xwOut.WriteEndElement(); //apply templates
1563 xwOut.WriteFullEndElement(); //copy
1564 xwOut.WriteFullEndElement(); //template
1565
1566 ArrayList alFieldNames = new ArrayList();
1567
1568 //read from schema file
1569 //Open XMLTextReader
1570 System.IO.FileStream fsIn = new System.IO.FileStream
1571 (sFileIn, System.IO.FileMode.Open);
1572 System.Xml.XmlTextReader xrIn =
1573 new System.Xml.XmlTextReader(fsIn);
1574
1575 string sFieldName = "";
1576 while (xrIn.Read())
1577 {
1578 if (xrIn.NodeType == XmlNodeType.Element)
1579 {
1580 switch (xrIn.LocalName)
1581 {
1582 case "element":
1583 if (xrIn.MoveToAttribute("name"))
1584 {
1585 sFieldName = xrIn.Value;
1586 if (xrIn.MoveToAttribute("type"))
1587 {
1588 if (xrIn.Value == "xs:dateTime")
1589 {
1590 alFieldNames.Add(sFieldName);
1591 }
1592 }
1593 }
1594 else
1595 {
1596 xrIn.Skip();
1597 }
1598 break;
1599 }//switch
1600 }//if
1601 }//while
1602
1603 //build conversion templates
1604 for (int j=0; j < alFieldNames.Count; j++)
1605 {
1606 sFieldName = alFieldNames[j].ToString();
1607 xwOut.WriteStartElement("xsl", "template", null);
1608 xwOut.WriteAttributeString("match", sFieldName);
1609
1610 xwOut.WriteStartElement("xsl", "element", null);
1611 xwOut.WriteAttributeString("name", sFieldName);
1612
1613 xwOut.WriteStartElement("xsl", "value-of", null);
1614 xwOut.WriteAttributeString("select", "bmx:ExcelDate(.)");
1615
1616 xwOut.WriteEndElement(); //value-of
1617 xwOut.WriteFullEndElement(); //element
1618 xwOut.WriteFullEndElement(); //template
1619 }
1620
1621 xwOut.WriteFullEndElement(); //stylesheet
1622 xwOut.Close();
1623 }
1624
1625 /*
1626 * Controls Demo
1627 * Demonstrates how to populate controls from a datatable
1628 */
1629 private void cmdCDLoad_Click(object sender, System.EventArgs e)
1630 {
1631 try
1632 {
1633 if (m_ci.Connected == false)
1634 {
1635 throw new BMXNetException("Not connected to RPMS.");
1636 }
1637
1638 string sCommandText = "BMX ADO SS^PATIENT DEMOGRAPHICS^^~1~50~";
1639 DataTable dt = m_ci.RPMSDataTable(sCommandText, "ControlsDemo");
1640
1641 txtCDName.DataBindings.Clear();
1642 txtCDSex.DataBindings.Clear();
1643 txtCDDOB.DataBindings.Clear();
1644 txtCDSSN.DataBindings.Clear();
1645 calCDDOB.DataBindings.Clear();
1646 dtpCDDOB.DataBindings.Clear();
1647 lstCDSex.DataBindings.Clear();
1648
1649 DataView dvCDPat = new DataView(dt);
1650 dvCDPat.Sort = "NAME ASC";
1651
1652 cboCDSelect.DataSource = dvCDPat;
1653 cboCDSelect.DisplayMember = "NAME";
1654 cboCDSelect.ValueMember = "BMXIEN";
1655
1656 txtCDName.DataBindings.Add("Text", dvCDPat, "NAME");
1657 txtCDSex.DataBindings.Add("Text", dvCDPat, "SEX");
1658 txtCDDOB.DataBindings.Add("Text", dvCDPat, "DOB");
1659 txtCDSSN.DataBindings.Add("Text", dvCDPat, "SSN");
1660
1661 calCDDOB.DataBindings.Add("SelectionStart", dvCDPat, "DOB");
1662 calCDDOB.DataBindings.Add("SelectionEnd", dvCDPat, "DOB");
1663
1664 dtpCDDOB.DataBindings.Add("Value", dvCDPat, "DOB");
1665
1666 lstCDSex.DataBindings.Add("SelectedItem", dvCDPat, "SEX");
1667
1668 }
1669 catch (Exception ex)
1670 {
1671 MessageBox.Show(ex.Message);
1672 return;
1673 }
1674 }
1675
1676 private void cmdAddAll_Click(object sender, System.EventArgs e)
1677 {
1678 /*
1679 * How to Accept Updates to an updateable recordset
1680 * using the new schema format and the data adapter's Update method
1681 */
1682
1683 try
1684 {
1685 DataTable dtPrimary = (DataTable) dataGrid2.DataSource;
1686 DataSet ds = dtPrimary.DataSet;
1687
1688
1689
1690 foreach (DataTable dt in ds.Tables)
1691 {
1692
1693 BMXNetConnection conn = new BMXNetConnection(m_ci.bmxNetLib);
1694
1695 object[] oVal = new object[dt.Columns.Count];
1696 //Call adapter's Update method
1697 int nRowCount = dt.Rows.Count;
1698 for (int j=0; j < nRowCount; j++ )
1699 {
1700 DataRow r = dt.Rows[j];
1701 for (int k = 0; k < dt.Columns.Count; k++)
1702 {
1703 oVal[k] = r[dt.Columns[k].ColumnName];
1704 }
1705 DataRow rAdd = dt.Rows.Add(oVal);
1706 }
1707
1708 DataTable dtc = dt.GetChanges();
1709 if (dtc != null)
1710 {
1711 DataTable dtSchema = m_da.FillSchema(dtc, SchemaType.Source);
1712
1713 //Build UPDATE command based on info stored in table's extended property set
1714 BMXNetCommand bmxUpdateCmd = new BMXNetCommand();
1715 bmxUpdateCmd.Connection = conn;
1716
1717 //Call BMXBuildUpdateCommand(dtSchema) to set up parameters
1718 bmxUpdateCmd.BMXBuildUpdateCommand(dtSchema);
1719
1720 //Link command to data adapter
1721 m_da.UpdateCommand = bmxUpdateCmd;
1722
1723 //Call adapter's Update method
1724 m_da.Update(dtc);
1725
1726 //Accept the changes to the datagrid's datatable
1727 dt.RejectChanges();
1728 }
1729 }
1730 }
1731 catch (Exception ex)
1732 {
1733 MessageBox.Show(ex.Message);
1734 }
1735 }
1736
1737 #region Event Handling and Asynchronous Calls
1738
1739 private string m_sTask;
1740 private void cmdAsyncCall_Click(object sender, System.EventArgs e)
1741 {
1742 try
1743 {
1744 //Use the windows handle to create a unique event name
1745 Process pCurrent = Process.GetCurrentProcess();
1746 string sID = Environment.MachineName + "-";
1747 sID += pCurrent.Id.ToString();
1748 m_ci.SubscribeEvent("BMX ASYNC RESULT READY" + sID ); // this.Handle.ToString());
1749 //nTask corresponds to TaskMan's ZTSK
1750 int nTask = m_ci.RPMSDataTableAsyncQue(this.txtAsyncCommand.Text, "BMX ASYNC RESULT READY" + sID) ;//this.Handle.ToString());
1751 //Save ZTSK for later comparison
1752 m_sTask = nTask.ToString();
1753 }
1754 catch (Exception ex)
1755 {
1756 MessageBox.Show(ex.Message);
1757 }
1758 }
1759
1760 private void BMXNetEventHandler(Object obj, BMXNet.BMXNetEventArgs e)
1761 {
1762 try
1763 {
1764 //BMXNet events arrive on a separate thread from the UI thread,
1765 //thus UI methods should be called using BeginInvoke or Invoke
1766 UpdateEventMessageTextDelegate dlgUEMT = new UpdateEventMessageTextDelegate(UpdateEventMessageText);
1767 this.Invoke(dlgUEMT, new object[] {e.BMXEvent, e.BMXParam});
1768
1769 Process pCurrent = Process.GetCurrentProcess();
1770 string sID = Environment.MachineName + "-";
1771 sID += pCurrent.Id.ToString();
1772 if (e.BMXEvent == "BMX ASYNC RESULT READY" + sID)
1773 {
1774 string sTask = BMXNetLib.Piece(e.BMXParam, "~", 1);
1775 string sAsyncInfo = BMXNetLib.Piece(e.BMXParam,"~",2);
1776 DataTable dtAsyncGrid = m_ci.RPMSDataTableAsyncGet(sAsyncInfo, "AsyncData");
1777 UpdateAsyncGridDelegate uagd = new UpdateAsyncGridDelegate(UpdateAsyncGrid);
1778 this.BeginInvoke(uagd, new object[] {sTask, dtAsyncGrid});
1779 }
1780 }
1781 catch (Exception ex)
1782 {
1783 Debug.Write("BMXNetEventHandler exception: " + ex.Message + "\n");
1784 }
1785 }
1786
1787 delegate void UpdateAsyncGridDelegate(string sTask, DataTable dt);
1788 private void UpdateAsyncGrid(string sTask, DataTable dt)
1789 {
1790 try
1791 {
1792 //Assert that invoke is not required in any UI method that may be called
1793 //by a worker thread (e.g. from an event)
1794 Debug.Assert(this.InvokeRequired == false);
1795
1796 //Check that this is the same job that we tasked
1797 if (m_sTask != sTask)
1798 return;
1799
1800 grdAsyncResult.DataSource = dt;
1801 m_ci.UnSubscribeEvent("BMX ASYNC RESULT READY" + this.Handle.ToString());
1802 }
1803 catch (Exception ex)
1804 {
1805 Debug.Write("UpdateAsyncGrid exception: " + ex.Message + "\n");
1806 }
1807 }
1808
1809 delegate void UpdateEventMessageTextDelegate(string EventName, string Param);
1810
1811 private void UpdateEventMessageText(string EventName, string Param)
1812 {
1813 Debug.Assert(this.InvokeRequired == false);
1814 txtEventMessages.Text = "BMXNet event " + EventName + " fired with parameter " + Param;
1815 if (txtEventMessages.BackColor == System.Drawing.Color.LightGreen)
1816 {
1817 txtEventMessages.BackColor = System.Drawing.Color.LightCoral;
1818 }
1819 else
1820 {
1821 txtEventMessages.BackColor = System.Drawing.Color.LightGreen;
1822 }
1823 }
1824
1825 private void cmdRegisterEvent_Click(object sender, System.EventArgs e)
1826 {
1827 m_ci.SubscribeEvent(this.txtRegisterEvent.Text);
1828 }
1829
1830 private void cmdUnregisterEvent_Click(object sender, System.EventArgs e)
1831 {
1832 m_ci.UnSubscribeEvent(this.txtUnregisterEvent.Text);
1833 }
1834
1835 private void cmdRaiseEvent_Click(object sender, System.EventArgs e)
1836 {
1837 m_ci.RaiseEvent(this.txtRaiseEvent.Text, txtEventParam.Text, chkEventRaiseBack.Checked);
1838 }
1839
1840 private void cmdAcquireLock_Click(object sender, System.EventArgs e)
1841 {
1842 try
1843 {
1844 m_ci.bmxNetLib.BMXRWL.AcquireWriterLock(5);
1845 }
1846 catch (Exception ex)
1847 {
1848 MessageBox.Show(ex.Message);
1849 }
1850 }
1851
1852 private void cmdReleaseLock_Click(object sender, System.EventArgs e)
1853 {
1854 try
1855 {
1856 m_ci.bmxNetLib.BMXRWL.ReleaseWriterLock();
1857 }
1858 catch (Exception ex)
1859 {
1860 MessageBox.Show(ex.Message);
1861 }
1862 }
1863
1864 private void chkEnableEvents_CheckedChanged(object sender, System.EventArgs e)
1865 {
1866 m_ci.EventPollingInterval = Convert.ToInt16(nudEventPollingInterval.Value);
1867 m_ci.EventPollingEnabled = chkEnableEvents.Checked;
1868 }
1869
1870 private void nudEventPollingInterval_ValueChanged(object sender, System.EventArgs e)
1871 {
1872 m_ci.EventPollingInterval = Convert.ToInt16(nudEventPollingInterval.Value);
1873 }
1874
1875 #endregion Event Handling
1876
1877 private void cmdTestSilent_Click(object sender, EventArgs e)
1878 {
1879 try
1880 {
1881 this.m_ci.CloseConnection();
1882
1883 string sA = "";
1884 string sV = "";
1885 string sAddress = "";
1886 int nPort = 10501;
1887 string sN = "";
1888
1889 m_ci.LoadConnectInfo(sAddress, nPort, sA, sV, sN);
1890 }
1891 catch (Exception ex)
1892 {
1893 MessageBox.Show(ex.Message);
1894 }
1895
1896 }
1897
1898 private void cmdTestReceiveTimeout_Click(object sender, EventArgs e)
1899 {
1900 int nTest = 5000;
1901 this.m_ci.ReceiveTimeout = nTest;
1902 }
1903
1904 private void cmdStartLogging_Click(object sender, EventArgs e)
1905 {
1906 try
1907 {
1908 m_ci.bmxNetLib.StartLog();
1909 }
1910 catch (Exception ex)
1911 {
1912 MessageBox.Show("Unable to start logging: " + ex.Message);
1913 }
1914 }
1915
1916 private void cmdStopLogging_Click(object sender, EventArgs e)
1917 {
1918 try
1919 {
1920 m_ci.bmxNetLib.StopLog();
1921 }
1922 catch (Exception ex)
1923 {
1924 MessageBox.Show("Unable to stop logging: " + ex.Message);
1925 }
1926 }
1927
1928
1929
1930 }
1931}
Note: See TracBrowser for help on using the repository browser.