| [453] | 1 | //kt -- Modified with SourceScanner on 8/8/2007
 | 
|---|
 | 2 | unit fTemplateImport;
 | 
|---|
 | 3 | 
 | 
|---|
 | 4 | interface
 | 
|---|
 | 5 | 
 | 
|---|
 | 6 | uses
 | 
|---|
 | 7 |   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 | 
|---|
 | 8 |   Gauges, StdCtrls, ComCtrls, DKLang;
 | 
|---|
 | 9 | 
 | 
|---|
 | 10 | type
 | 
|---|
 | 11 |   TfrmTemplateImport = class(TForm)
 | 
|---|
 | 12 |     animImport: TAnimate;
 | 
|---|
 | 13 |     btnCancel: TButton;
 | 
|---|
 | 14 |     lblImporting: TStaticText;
 | 
|---|
 | 15 |     gaugeImport: TGauge;
 | 
|---|
 | 16 |     DKLanguageController1: TDKLanguageController;
 | 
|---|
 | 17 |     procedure btnCancelClick(Sender: TObject);
 | 
|---|
 | 18 |   private
 | 
|---|
 | 19 |     { Private declarations }
 | 
|---|
 | 20 |   public
 | 
|---|
 | 21 |     { Public declarations }
 | 
|---|
 | 22 |   end;
 | 
|---|
 | 23 | 
 | 
|---|
 | 24 | procedure StartImportMessage(AFileName: string; MaxCount: integer);
 | 
|---|
 | 25 | function UpdateImportMessage(CurrentCount: integer): boolean;
 | 
|---|
 | 26 | procedure StopImportMessage;
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 | implementation
 | 
|---|
 | 29 | 
 | 
|---|
 | 30 | {$R *.DFM}
 | 
|---|
 | 31 | 
 | 
|---|
 | 32 | uses
 | 
|---|
 | 33 |   ORFn;
 | 
|---|
 | 34 | 
 | 
|---|
 | 35 | var
 | 
|---|
 | 36 |   frmTemplateImport: TfrmTemplateImport = nil;
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 | procedure StartImportMessage(AFileName: string; MaxCount: integer);
 | 
|---|
 | 39 | begin
 | 
|---|
 | 40 |   if not assigned(frmTemplateImport) then
 | 
|---|
 | 41 |   begin
 | 
|---|
 | 42 |     frmTemplateImport := TfrmTemplateImport.Create(Application);
 | 
|---|
 | 43 |     ResizeAnchoredFormToFont(frmTemplateImport);
 | 
|---|
 | 44 |     with frmTemplateImport do
 | 
|---|
 | 45 |     begin
 | 
|---|
 | 46 |       lblImporting.Caption := lblImporting.Caption + AFileName;
 | 
|---|
 | 47 |       lblImporting.Hint := lblImporting.Caption;
 | 
|---|
 | 48 |       gaugeImport.MaxValue := MaxCount;
 | 
|---|
 | 49 |       Show;
 | 
|---|
 | 50 |       Application.ProcessMessages;
 | 
|---|
 | 51 |     end;
 | 
|---|
 | 52 |   end;
 | 
|---|
 | 53 | end;
 | 
|---|
 | 54 | 
 | 
|---|
 | 55 | function UpdateImportMessage(CurrentCount: integer): boolean;
 | 
|---|
 | 56 | begin
 | 
|---|
 | 57 |   if assigned(frmTemplateImport) then
 | 
|---|
 | 58 |   begin
 | 
|---|
 | 59 |     Result := (not frmTemplateImport.btnCancel.Enabled);
 | 
|---|
 | 60 |     if not Result then
 | 
|---|
 | 61 |     begin
 | 
|---|
 | 62 |       frmTemplateImport.gaugeImport.Progress := CurrentCount;
 | 
|---|
 | 63 |       Application.ProcessMessages;
 | 
|---|
 | 64 |     end;  
 | 
|---|
 | 65 |   end
 | 
|---|
 | 66 |   else
 | 
|---|
 | 67 |     Result := TRUE;
 | 
|---|
 | 68 | end;
 | 
|---|
 | 69 | 
 | 
|---|
 | 70 | procedure StopImportMessage;
 | 
|---|
 | 71 | begin
 | 
|---|
 | 72 |   if assigned(frmTemplateImport) then
 | 
|---|
 | 73 |     FreeAndNil(frmTemplateImport);
 | 
|---|
 | 74 | end;
 | 
|---|
 | 75 | 
 | 
|---|
 | 76 | 
 | 
|---|
 | 77 | procedure TfrmTemplateImport.btnCancelClick(Sender: TObject);
 | 
|---|
 | 78 | begin
 | 
|---|
 | 79 | //lblImporting.Caption := 'Canceling...';  <-- original line.  //kt 8/8/2007
 | 
|---|
 | 80 |   lblImporting.Caption := DKLangConstW('fTemplateImport_Cancelingxxx'); //kt added 8/8/2007
 | 
|---|
 | 81 |   btnCancel.Enabled := FALSE;
 | 
|---|
 | 82 |   Application.ProcessMessages;
 | 
|---|
 | 83 | end;
 | 
|---|
 | 84 | 
 | 
|---|
 | 85 | end.
 | 
|---|