source: cprs/branches/HealthSevak-CPRS/CPRS-Chart/fxBroker.pas@ 1679

Last change on this file since 1679 was 830, checked in by Kevin Toppenberg, 14 years ago

Upgrading to version 27

File size: 3.2 KB
Line 
1unit fxBroker;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 StdCtrls, DateUtils, ORNet, ORFn, rMisc, ComCtrls, Buttons, ExtCtrls,
8 ORCtrls, ORSystem, fBase508Form, VA508AccessibilityManager;
9
10type
11 TfrmBroker = class(TfrmBase508Form)
12 pnlTop: TORAutoPanel;
13 lblMaxCalls: TLabel;
14 txtMaxCalls: TCaptionEdit;
15 cmdPrev: TBitBtn;
16 cmdNext: TBitBtn;
17 udMax: TUpDown;
18 memData: TRichEdit;
19 lblCallID: TStaticText;
20 btnRLT: TButton;
21 procedure cmdPrevClick(Sender: TObject);
22 procedure cmdNextClick(Sender: TObject);
23 procedure FormClose(Sender: TObject; var Action: TCloseAction);
24 procedure FormResize(Sender: TObject);
25 procedure FormCreate(Sender: TObject);
26 procedure FormKeyUp(Sender: TObject; var Key: Word;
27 Shift: TShiftState);
28 procedure btnRLTClick(Sender: TObject);
29 private
30 { Private declarations }
31 FRetained: Integer;
32 FCurrent: Integer;
33 public
34 { Public declarations }
35 end;
36
37procedure ShowBroker;
38
39implementation
40
41{$R *.DFM}
42
43procedure ShowBroker;
44var
45 frmBroker: TfrmBroker;
46begin
47 frmBroker := TfrmBroker.Create(Application);
48 try
49 ResizeAnchoredFormToFont(frmBroker);
50 with frmBroker do
51 begin
52 FRetained := RetainedRPCCount - 1;
53 FCurrent := FRetained;
54 LoadRPCData(memData.Lines, FCurrent);
55 memData.SelStart := 0;
56 lblCallID.Caption := 'Last Call Minus: ' + IntToStr(FRetained - FCurrent);
57 ShowModal;
58 end;
59 finally
60 frmBroker.Release;
61 end;
62end;
63
64procedure TfrmBroker.cmdPrevClick(Sender: TObject);
65begin
66 FCurrent := HigherOf(FCurrent - 1, 0);
67 LoadRPCData(memData.Lines, FCurrent);
68 memData.SelStart := 0;
69 lblCallID.Caption := 'Last Call Minus: ' + IntToStr(FRetained - FCurrent);
70end;
71
72procedure TfrmBroker.cmdNextClick(Sender: TObject);
73begin
74 FCurrent := LowerOf(FCurrent + 1, FRetained);
75 LoadRPCData(memData.Lines, FCurrent);
76 memData.SelStart := 0;
77 lblCallID.Caption := 'Last Call Minus: ' + IntToStr(FRetained - FCurrent);
78end;
79
80procedure TfrmBroker.FormClose(Sender: TObject; var Action: TCloseAction);
81begin
82 SetRetainedRPCMax(StrToIntDef(txtMaxCalls.Text, 5))
83end;
84
85procedure TfrmBroker.FormResize(Sender: TObject);
86begin
87 Refresh;
88end;
89
90procedure TfrmBroker.FormCreate(Sender: TObject);
91begin
92 udMax.Position := GetRPCMax;
93end;
94
95procedure TfrmBroker.FormKeyUp(Sender: TObject; var Key: Word;
96 Shift: TShiftState);
97begin
98 if Key = VK_ESCAPE then
99 begin
100 Key := 0;
101 Close;
102 end;
103end;
104
105procedure TfrmBroker.btnRLTClick(Sender: TObject);
106var
107 startTime, endTime: tDateTime;
108 clientVer, serverVer, diffDisplay: string;
109 theDiff: integer;
110const
111 TX_OPTION = 'OR CPRS GUI CHART';
112 disclaimer = 'NOTE: Strictly relative indicator:';
113begin
114
115clientVer := clientVersion(Application.ExeName); // Obtain before starting.
116
117// Check time lapse between a standard RPC call:
118startTime := now;
119serverVer := serverVersion(TX_OPTION, clientVer);
120endTime := now;
121theDiff := milliSecondsBetween(endTime, startTime);
122diffDisplay := intToStr(theDiff);
123
124// Show the results:
125infoBox('Lapsed time (milliseconds) = ' + diffDisplay + '.', disclaimer, MB_OK);
126
127end;
128
129end.
Note: See TracBrowser for help on using the repository browser.