1 | //kt -- Modified with SourceScanner on 8/29/2007
|
---|
2 | unit frmImageTransferProgress;
|
---|
3 | //kt Added this entire form.
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
---|
9 | Dialogs, ExtCtrls, StdCtrls, ComCtrls, DKLang;
|
---|
10 |
|
---|
11 | type
|
---|
12 | TImageTransferForm = class(TForm)
|
---|
13 | ProgressBar: TProgressBar;
|
---|
14 | Label1: TLabel;
|
---|
15 | Image1: TImage;
|
---|
16 | ProgressMsg: TLabel;
|
---|
17 | DKLanguageController1: TDKLanguageController;
|
---|
18 | private
|
---|
19 | { Private declarations }
|
---|
20 | //startTime: TDateTime;
|
---|
21 | //procedure DetermineIntervalTimes();
|
---|
22 | public
|
---|
23 | { Public declarations }
|
---|
24 | //procedure ResetStartTime;
|
---|
25 | procedure setMax(Max : integer);
|
---|
26 | procedure updateProgress(Current: integer);
|
---|
27 | end;
|
---|
28 |
|
---|
29 | var
|
---|
30 | ImageTransferForm: TImageTransferForm;
|
---|
31 |
|
---|
32 | implementation
|
---|
33 |
|
---|
34 | {$R *.dfm}
|
---|
35 |
|
---|
36 | //uses DateUtils,Math;
|
---|
37 |
|
---|
38 | {
|
---|
39 | procedure TUploadProgressForm.ResetStartTime();
|
---|
40 | begin
|
---|
41 | startTime := Now;
|
---|
42 | end;
|
---|
43 | }
|
---|
44 |
|
---|
45 | procedure TImageTransferForm.setMax(Max : integer);
|
---|
46 | begin
|
---|
47 | ProgressBar.Max := Max;
|
---|
48 | end;
|
---|
49 |
|
---|
50 |
|
---|
51 | procedure TImageTransferForm.updateProgress(Current: integer);
|
---|
52 | begin
|
---|
53 | ProgressBar.Position := Current;
|
---|
54 | //DetermineIntervalTimes();
|
---|
55 | end;
|
---|
56 |
|
---|
57 | {
|
---|
58 | procedure TUploadProgressForm.DetermineIntervalTimes();
|
---|
59 | var
|
---|
60 | elapsedSec: int64;
|
---|
61 |
|
---|
62 | elapsedTime : TDateTime;
|
---|
63 | remaining : integer;
|
---|
64 | rate : real;
|
---|
65 | remainSec : int64;
|
---|
66 |
|
---|
67 | begin
|
---|
68 | elapsedSec := SecondsBetween(Now,startTime);
|
---|
69 | if elapsedSec < 1 then elapsedSec := 1;
|
---|
70 | elapsedTime := IncSecond(0,elapsedSec);
|
---|
71 | // DecodeDateTime(elapsedTime; out AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond: Word);
|
---|
72 | ElapsedTimeLabel.Caption := TimeToStr(elapsedTime);
|
---|
73 |
|
---|
74 | rate := ProgressBar.Max / elapsedSec;
|
---|
75 | remainSec := floor ((ProgressBar.Max-ProgressBar.Position) / rate);
|
---|
76 | RemainingTimeLabel.Caption := TimeToStr(IncSecond(0,remainSec));
|
---|
77 | end;
|
---|
78 | }
|
---|
79 |
|
---|
80 | end.
|
---|