[729] | 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;
|
---|
[793] | 18 | btnCancel: TButton;
|
---|
[729] | 19 | private
|
---|
| 20 | { Private declarations }
|
---|
| 21 | //startTime: TDateTime;
|
---|
| 22 | //procedure DetermineIntervalTimes();
|
---|
| 23 | public
|
---|
| 24 | { Public declarations }
|
---|
| 25 | //procedure ResetStartTime;
|
---|
| 26 | procedure setMax(Max : integer);
|
---|
| 27 | procedure updateProgress(Current: integer);
|
---|
| 28 | end;
|
---|
| 29 |
|
---|
| 30 | var
|
---|
| 31 | ImageTransferForm: TImageTransferForm;
|
---|
| 32 |
|
---|
| 33 | implementation
|
---|
| 34 |
|
---|
| 35 | {$R *.dfm}
|
---|
| 36 |
|
---|
| 37 | //uses DateUtils,Math;
|
---|
| 38 |
|
---|
| 39 | {
|
---|
| 40 | procedure TUploadProgressForm.ResetStartTime();
|
---|
| 41 | begin
|
---|
| 42 | startTime := Now;
|
---|
| 43 | end;
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | procedure TImageTransferForm.setMax(Max : integer);
|
---|
| 47 | begin
|
---|
| 48 | ProgressBar.Max := Max;
|
---|
| 49 | end;
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | procedure TImageTransferForm.updateProgress(Current: integer);
|
---|
| 53 | begin
|
---|
| 54 | ProgressBar.Position := Current;
|
---|
| 55 | //DetermineIntervalTimes();
|
---|
| 56 | end;
|
---|
| 57 |
|
---|
| 58 | {
|
---|
| 59 | procedure TUploadProgressForm.DetermineIntervalTimes();
|
---|
| 60 | var
|
---|
| 61 | elapsedSec: int64;
|
---|
| 62 |
|
---|
| 63 | elapsedTime : TDateTime;
|
---|
| 64 | remaining : integer;
|
---|
| 65 | rate : real;
|
---|
| 66 | remainSec : int64;
|
---|
| 67 |
|
---|
| 68 | begin
|
---|
| 69 | elapsedSec := SecondsBetween(Now,startTime);
|
---|
| 70 | if elapsedSec < 1 then elapsedSec := 1;
|
---|
| 71 | elapsedTime := IncSecond(0,elapsedSec);
|
---|
| 72 | // DecodeDateTime(elapsedTime; out AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond: Word);
|
---|
| 73 | ElapsedTimeLabel.Caption := TimeToStr(elapsedTime);
|
---|
| 74 |
|
---|
| 75 | rate := ProgressBar.Max / elapsedSec;
|
---|
| 76 | remainSec := floor ((ProgressBar.Max-ProgressBar.Position) / rate);
|
---|
| 77 | RemainingTimeLabel.Caption := TimeToStr(IncSecond(0,remainSec));
|
---|
| 78 | end;
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | end.
|
---|