[456] | 1 | unit fxBroker;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 7 | StdCtrls, DateUtils, ORNet, ORFn, rMisc, ComCtrls, Buttons, ExtCtrls,
|
---|
[830] | 8 | ORCtrls, ORSystem, fBase508Form, VA508AccessibilityManager;
|
---|
[456] | 9 |
|
---|
| 10 | type
|
---|
[830] | 11 | TfrmBroker = class(TfrmBase508Form)
|
---|
[456] | 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 |
|
---|
| 37 | procedure ShowBroker;
|
---|
| 38 |
|
---|
| 39 | implementation
|
---|
| 40 |
|
---|
| 41 | {$R *.DFM}
|
---|
| 42 |
|
---|
| 43 | procedure ShowBroker;
|
---|
| 44 | var
|
---|
| 45 | frmBroker: TfrmBroker;
|
---|
| 46 | begin
|
---|
| 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;
|
---|
| 62 | end;
|
---|
| 63 |
|
---|
| 64 | procedure TfrmBroker.cmdPrevClick(Sender: TObject);
|
---|
| 65 | begin
|
---|
| 66 | FCurrent := HigherOf(FCurrent - 1, 0);
|
---|
| 67 | LoadRPCData(memData.Lines, FCurrent);
|
---|
| 68 | memData.SelStart := 0;
|
---|
| 69 | lblCallID.Caption := 'Last Call Minus: ' + IntToStr(FRetained - FCurrent);
|
---|
| 70 | end;
|
---|
| 71 |
|
---|
| 72 | procedure TfrmBroker.cmdNextClick(Sender: TObject);
|
---|
| 73 | begin
|
---|
| 74 | FCurrent := LowerOf(FCurrent + 1, FRetained);
|
---|
| 75 | LoadRPCData(memData.Lines, FCurrent);
|
---|
| 76 | memData.SelStart := 0;
|
---|
| 77 | lblCallID.Caption := 'Last Call Minus: ' + IntToStr(FRetained - FCurrent);
|
---|
| 78 | end;
|
---|
| 79 |
|
---|
| 80 | procedure TfrmBroker.FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
| 81 | begin
|
---|
| 82 | SetRetainedRPCMax(StrToIntDef(txtMaxCalls.Text, 5))
|
---|
| 83 | end;
|
---|
| 84 |
|
---|
| 85 | procedure TfrmBroker.FormResize(Sender: TObject);
|
---|
| 86 | begin
|
---|
| 87 | Refresh;
|
---|
| 88 | end;
|
---|
| 89 |
|
---|
| 90 | procedure TfrmBroker.FormCreate(Sender: TObject);
|
---|
| 91 | begin
|
---|
| 92 | udMax.Position := GetRPCMax;
|
---|
| 93 | end;
|
---|
| 94 |
|
---|
| 95 | procedure TfrmBroker.FormKeyUp(Sender: TObject; var Key: Word;
|
---|
| 96 | Shift: TShiftState);
|
---|
| 97 | begin
|
---|
| 98 | if Key = VK_ESCAPE then
|
---|
| 99 | begin
|
---|
| 100 | Key := 0;
|
---|
| 101 | Close;
|
---|
| 102 | end;
|
---|
| 103 | end;
|
---|
| 104 |
|
---|
| 105 | procedure TfrmBroker.btnRLTClick(Sender: TObject);
|
---|
| 106 | var
|
---|
| 107 | startTime, endTime: tDateTime;
|
---|
| 108 | clientVer, serverVer, diffDisplay: string;
|
---|
| 109 | theDiff: integer;
|
---|
| 110 | const
|
---|
| 111 | TX_OPTION = 'OR CPRS GUI CHART';
|
---|
| 112 | disclaimer = 'NOTE: Strictly relative indicator:';
|
---|
| 113 | begin
|
---|
| 114 |
|
---|
| 115 | clientVer := clientVersion(Application.ExeName); // Obtain before starting.
|
---|
| 116 |
|
---|
| 117 | // Check time lapse between a standard RPC call:
|
---|
| 118 | startTime := now;
|
---|
| 119 | serverVer := serverVersion(TX_OPTION, clientVer);
|
---|
| 120 | endTime := now;
|
---|
| 121 | theDiff := milliSecondsBetween(endTime, startTime);
|
---|
| 122 | diffDisplay := intToStr(theDiff);
|
---|
| 123 |
|
---|
| 124 | // Show the results:
|
---|
| 125 | infoBox('Lapsed time (milliseconds) = ' + diffDisplay + '.', disclaimer, MB_OK);
|
---|
| 126 |
|
---|
| 127 | end;
|
---|
| 128 |
|
---|
| 129 | end.
|
---|