[453] | 1 | //kt -- Modified with SourceScanner on 8/20/2007
|
---|
| 2 | unit fTimeout;
|
---|
| 3 |
|
---|
| 4 | interface
|
---|
| 5 |
|
---|
| 6 | uses
|
---|
| 7 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 8 | fAutoSz, ExtCtrls, StdCtrls, ORFn, DKLang;
|
---|
| 9 |
|
---|
| 10 | type
|
---|
| 11 | TfrmTimeout = class(TfrmAutoSz)
|
---|
| 12 | Label1: TStaticText;
|
---|
| 13 | Label2: TStaticText;
|
---|
| 14 | cmdContinue: TButton;
|
---|
| 15 | lblCount: TStaticText;
|
---|
| 16 | timCountDown: TTimer;
|
---|
| 17 | DKLanguageController2: TDKLanguageController;
|
---|
| 18 | procedure FormCreate(Sender: TObject);
|
---|
| 19 | procedure cmdContinueClick(Sender: TObject);
|
---|
| 20 | procedure timCountDownTimer(Sender: TObject);
|
---|
| 21 | private
|
---|
| 22 | { Private declarations }
|
---|
| 23 | FContinue: Boolean;
|
---|
| 24 | FCount: Integer;
|
---|
| 25 | end;
|
---|
| 26 |
|
---|
| 27 | function AllowTimeout: Boolean;
|
---|
| 28 |
|
---|
| 29 | implementation
|
---|
| 30 |
|
---|
| 31 | {$R *.DFM}
|
---|
| 32 |
|
---|
| 33 | uses uCore;
|
---|
| 34 |
|
---|
| 35 | function AllowTimeout: Boolean;
|
---|
| 36 | var
|
---|
| 37 | frmTimeout: TfrmTimeout;
|
---|
| 38 | begin
|
---|
| 39 | frmTimeout := TfrmTimeout.Create(Application);
|
---|
| 40 | try
|
---|
| 41 | ResizeFormToFont(TForm(frmTimeout));
|
---|
| 42 | frmTimeout.ShowModal;
|
---|
| 43 | Result := not frmTimeout.FContinue;
|
---|
| 44 | finally
|
---|
| 45 | frmTimeout.Release;
|
---|
| 46 | end;
|
---|
| 47 | end;
|
---|
| 48 |
|
---|
| 49 | procedure TfrmTimeout.FormCreate(Sender: TObject);
|
---|
| 50 | begin
|
---|
| 51 | inherited;
|
---|
| 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.
|
---|