| 1 | unit fTimeout;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 7 | fAutoSz, ExtCtrls, StdCtrls, ORFn, VA508AccessibilityManager;
|
---|
| 8 |
|
---|
| 9 | type
|
---|
| 10 | TfrmTimeout = class(TfrmAutoSz)
|
---|
| 11 | Label1: TStaticText;
|
---|
| 12 | Label2: TStaticText;
|
---|
| 13 | cmdContinue: TButton;
|
---|
| 14 | lblCount: TStaticText;
|
---|
| 15 | timCountDown: TTimer;
|
---|
| 16 | procedure FormCreate(Sender: TObject);
|
---|
| 17 | procedure cmdContinueClick(Sender: TObject);
|
---|
| 18 | procedure timCountDownTimer(Sender: TObject);
|
---|
| 19 | private
|
---|
| 20 | { Private declarations }
|
---|
| 21 | FContinue: Boolean;
|
---|
| 22 | FCount: Integer;
|
---|
| 23 | end;
|
---|
| 24 |
|
---|
| 25 | function AllowTimeout: Boolean;
|
---|
| 26 |
|
---|
| 27 | implementation
|
---|
| 28 |
|
---|
| 29 | {$R *.DFM}
|
---|
| 30 |
|
---|
| 31 | uses uCore;
|
---|
| 32 |
|
---|
| 33 | function AllowTimeout: Boolean;
|
---|
| 34 | var
|
---|
| 35 | frmTimeout: TfrmTimeout;
|
---|
| 36 | begin
|
---|
| 37 | frmTimeout := TfrmTimeout.Create(Application);
|
---|
| 38 | try
|
---|
| 39 | ResizeFormToFont(TForm(frmTimeout));
|
---|
| 40 | frmTimeout.ShowModal;
|
---|
| 41 | Result := not frmTimeout.FContinue;
|
---|
| 42 | finally
|
---|
| 43 | frmTimeout.Release;
|
---|
| 44 | end;
|
---|
| 45 | end;
|
---|
| 46 |
|
---|
| 47 | procedure TfrmTimeout.FormCreate(Sender: TObject);
|
---|
| 48 | begin
|
---|
| 49 | inherited;
|
---|
| 50 | Application.Restore;
|
---|
| 51 | Application.BringToFront;
|
---|
| 52 | MessageBeep(MB_ICONASTERISK);
|
---|
| 53 | FCount := User.CountDown;
|
---|
| 54 | lblCount.Caption := IntToStr(FCount);
|
---|
| 55 | end;
|
---|
| 56 |
|
---|
| 57 | procedure TfrmTimeout.cmdContinueClick(Sender: TObject);
|
---|
| 58 | begin
|
---|
| 59 | inherited;
|
---|
| 60 | FContinue := True;
|
---|
| 61 | Close;
|
---|
| 62 | end;
|
---|
| 63 |
|
---|
| 64 | procedure TfrmTimeout.timCountDownTimer(Sender: TObject);
|
---|
| 65 | begin
|
---|
| 66 | inherited;
|
---|
| 67 | if FCount = User.CountDown then
|
---|
| 68 | begin
|
---|
| 69 | MessageBeep(MB_ICONASTERISK);
|
---|
| 70 | timCountDown.Enabled := False;
|
---|
| 71 | timCountDown.Interval := 1000;
|
---|
| 72 | timCountDown.Enabled := True;
|
---|
| 73 | end;
|
---|
| 74 | Dec(FCount);
|
---|
| 75 | lblCount.Caption := IntToStr(FCount);
|
---|
| 76 | if FCount = 0 then
|
---|
| 77 | begin
|
---|
| 78 | timCountDown.Enabled := False;
|
---|
| 79 | Close;
|
---|
| 80 | end;
|
---|
| 81 | end;
|
---|
| 82 |
|
---|
| 83 | end.
|
---|