[456] | 1 | unit fTimeout;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
[830] | 7 | fAutoSz, ExtCtrls, StdCtrls, ORFn, VA508AccessibilityManager;
|
---|
[456] | 8 |
|
---|
| 9 | type
|
---|
| 10 | TfrmTimeout = class(TfrmAutoSz)
|
---|
[1693] | 11 | timCountDown: TTimer;
|
---|
| 12 | pnlTop: TPanel;
|
---|
[456] | 13 | Label1: TStaticText;
|
---|
| 14 | Label2: TStaticText;
|
---|
[1693] | 15 | pnlBottom: TPanel;
|
---|
| 16 | btnClose: TButton;
|
---|
[456] | 17 | cmdContinue: TButton;
|
---|
| 18 | lblCount: TStaticText;
|
---|
[1693] | 19 | pnlWarning: TPanel;
|
---|
| 20 | imgWarning: TImage;
|
---|
| 21 | lblWarning: TLabel;
|
---|
| 22 | lblWarningMultiple: TLabel;
|
---|
| 23 | lblWarningContinue: TLabel;
|
---|
| 24 | lblWarningPatient: TLabel;
|
---|
[456] | 25 | procedure FormCreate(Sender: TObject);
|
---|
| 26 | procedure cmdContinueClick(Sender: TObject);
|
---|
| 27 | procedure timCountDownTimer(Sender: TObject);
|
---|
[1693] | 28 | procedure FormShow(Sender: TObject);
|
---|
| 29 | procedure btnCloseClick(Sender: TObject);
|
---|
[456] | 30 | private
|
---|
| 31 | { Private declarations }
|
---|
| 32 | FContinue: Boolean;
|
---|
| 33 | FCount: Integer;
|
---|
| 34 | end;
|
---|
| 35 |
|
---|
| 36 | function AllowTimeout: Boolean;
|
---|
| 37 |
|
---|
| 38 | implementation
|
---|
| 39 |
|
---|
| 40 | {$R *.DFM}
|
---|
| 41 |
|
---|
| 42 | uses uCore;
|
---|
| 43 |
|
---|
| 44 | function AllowTimeout: Boolean;
|
---|
| 45 | var
|
---|
| 46 | frmTimeout: TfrmTimeout;
|
---|
| 47 | begin
|
---|
| 48 | frmTimeout := TfrmTimeout.Create(Application);
|
---|
| 49 | try
|
---|
| 50 | ResizeFormToFont(TForm(frmTimeout));
|
---|
| 51 | frmTimeout.ShowModal;
|
---|
| 52 | Result := not frmTimeout.FContinue;
|
---|
| 53 | finally
|
---|
| 54 | frmTimeout.Release;
|
---|
| 55 | end;
|
---|
| 56 | end;
|
---|
| 57 |
|
---|
| 58 | procedure TfrmTimeout.FormCreate(Sender: TObject);
|
---|
| 59 | begin
|
---|
| 60 | inherited;
|
---|
[830] | 61 | Application.Restore;
|
---|
| 62 | Application.BringToFront;
|
---|
[456] | 63 | MessageBeep(MB_ICONASTERISK);
|
---|
| 64 | FCount := User.CountDown;
|
---|
| 65 | lblCount.Caption := IntToStr(FCount);
|
---|
| 66 | end;
|
---|
| 67 |
|
---|
[1693] | 68 | procedure TfrmTimeout.FormShow(Sender: TObject);
|
---|
| 69 | begin
|
---|
| 70 | inherited;
|
---|
| 71 | SetForegroundWindow(Handle);
|
---|
| 72 | lblWarningPatient.Caption := Patient.Name;
|
---|
| 73 | lblWarning.Font.Size := lblWarningPatient.Font.Size + 4;
|
---|
| 74 | if CPRSInstances < 2 then
|
---|
| 75 | begin
|
---|
| 76 | pnlWarning.Visible := false;
|
---|
| 77 | Height := Height - pnlWarning.Height;
|
---|
| 78 | end;
|
---|
| 79 | end;
|
---|
| 80 |
|
---|
| 81 | procedure TfrmTimeout.btnCloseClick(Sender: TObject);
|
---|
| 82 | begin
|
---|
| 83 | inherited;
|
---|
| 84 | FContinue := False;
|
---|
| 85 | Close;
|
---|
| 86 | end;
|
---|
| 87 |
|
---|
[456] | 88 | procedure TfrmTimeout.cmdContinueClick(Sender: TObject);
|
---|
| 89 | begin
|
---|
| 90 | inherited;
|
---|
| 91 | FContinue := True;
|
---|
| 92 | Close;
|
---|
| 93 | end;
|
---|
| 94 |
|
---|
| 95 | procedure TfrmTimeout.timCountDownTimer(Sender: TObject);
|
---|
| 96 | begin
|
---|
| 97 | inherited;
|
---|
| 98 | if FCount = User.CountDown then
|
---|
| 99 | begin
|
---|
| 100 | MessageBeep(MB_ICONASTERISK);
|
---|
| 101 | timCountDown.Enabled := False;
|
---|
| 102 | timCountDown.Interval := 1000;
|
---|
| 103 | timCountDown.Enabled := True;
|
---|
| 104 | end;
|
---|
| 105 | Dec(FCount);
|
---|
| 106 | lblCount.Caption := IntToStr(FCount);
|
---|
[1693] | 107 | if FCount < 1 then
|
---|
[456] | 108 | begin
|
---|
| 109 | timCountDown.Enabled := False;
|
---|
| 110 | Close;
|
---|
| 111 | end;
|
---|
| 112 | end;
|
---|
| 113 |
|
---|
| 114 | end.
|
---|