Changeset 85 for trunk/Packages/Common/JobProgressView.pas
- Timestamp:
- Jun 7, 2024, 11:59:43 AM (5 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/JobProgressView.pas
r84 r85 1 unit UJobProgressView; 2 3 {$MODE Delphi} 1 unit JobProgressView; 4 2 5 3 interface … … 7 5 uses 8 6 SysUtils, Variants, Classes, Graphics, Controls, Forms, Syncobjs, 9 Dialogs, ComCtrls, StdCtrls, ExtCtrls, Contnrs, UThreading, Math,7 Dialogs, ComCtrls, StdCtrls, ExtCtrls, Generics.Collections, Threading, Math, 10 8 DateUtils; 11 9 … … 71 69 end; 72 70 73 TJobs = class(TObjectList )71 TJobs = class(TObjectList<TJob>) 74 72 end; 75 73 … … 105 103 procedure ReloadJobList; 106 104 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 107 procedure FormDestroy(Sender: TObject);108 105 procedure ListViewJobsData(Sender: TObject; Item: TListItem); 109 106 procedure TimerUpdateTimer(Sender: TObject); … … 157 154 end; 158 155 159 //var160 // FormJobProgressView: TFormJobProgressView;161 162 156 procedure Register; 163 157 164 158 resourcestring 165 159 SExecuted = 'Executed'; 160 166 161 167 162 implementation … … 187 182 try 188 183 try 189 //raise Exception.Create('Exception in job');190 184 ProgressView.CurrentJob.Method(Job); 191 185 except … … 286 280 end; 287 281 288 procedure TFormJobProgressView.FormDestroy(Sender:TObject);289 begin290 end;291 292 282 procedure TFormJobProgressView.ListViewJobsData(Sender: TObject; Item: TListItem); 293 283 begin 294 284 if (Item.Index >= 0) and (Item.Index < JobProgressView.Jobs.Count) then 295 with TJob(JobProgressView.Jobs[Item.Index])do begin285 with JobProgressView.Jobs[Item.Index] do begin 296 286 Item.Caption := Title; 297 287 if Item.Index = JobProgressView.CurrentJobIndex then Item.ImageIndex := 1 … … 405 395 I := 0; 406 396 while I < Jobs.Count do 407 with TJob(Jobs[I])do begin397 with Jobs[I] do begin 408 398 CurrentJobIndex := I; 409 CurrentJob := TJob(Jobs[I]);399 CurrentJob := Jobs[I]; 410 400 JobProgressChange(Self); 411 401 StartTime := Now; … … 420 410 Method(CurrentJob); 421 411 end else begin 412 Thread := TJobThread.Create(True); 422 413 try 423 Thread := TJobThread.Create(True);424 414 with Thread do begin 425 415 FreeOnTerminate := False; … … 494 484 if AValue = FTerminate then Exit; 495 485 for I := 0 to Jobs.Count - 1 do 496 TJob(Jobs[I]).Terminate := AValue;486 Jobs[I].Terminate := AValue; 497 487 FTerminate := AValue; 498 488 end; … … 620 610 procedure TProgress.Increment; 621 611 begin 622 try623 FLock.Acquire;612 FLock.Acquire; 613 try 624 614 Value := Value + 1; 625 615 finally … … 630 620 procedure TProgress.Reset; 631 621 begin 632 try633 FLock.Acquire;622 FLock.Acquire; 623 try 634 624 FValue := 0; 635 625 finally … … 647 637 begin 648 638 FLock.Free; 649 inherited Destroy;639 inherited; 650 640 end; 651 641 … … 678 668 destructor TJob.Destroy; 679 669 begin 680 Progress.Free;670 FreeAndNil(Progress); 681 671 inherited; 682 672 end;
Note:
See TracChangeset
for help on using the changeset viewer.