Changeset 424 for trunk/Packages/Common/UJobProgressView.pas
- Timestamp:
- Apr 25, 2022, 6:22:53 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/UJobProgressView.pas
r423 r424 5 5 uses 6 6 SysUtils, Variants, Classes, Graphics, Controls, Forms, Syncobjs, 7 Dialogs, ComCtrls, StdCtrls, ExtCtrls, Contnrs, UThreading, Math,7 Dialogs, ComCtrls, StdCtrls, ExtCtrls, Generics.Collections, UThreading, Math, 8 8 DateUtils; 9 9 … … 69 69 end; 70 70 71 TJobs = class(TObjectList )71 TJobs = class(TObjectList<TJob>) 72 72 end; 73 73 … … 103 103 procedure ReloadJobList; 104 104 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 105 procedure FormDestroy(Sender: TObject);106 105 procedure ListViewJobsData(Sender: TObject; Item: TListItem); 107 106 procedure TimerUpdateTimer(Sender: TObject); … … 163 162 SExecuted = 'Executed'; 164 163 164 165 165 implementation 166 166 … … 284 284 end; 285 285 286 procedure TFormJobProgressView.FormDestroy(Sender:TObject);287 begin288 end;289 290 286 procedure TFormJobProgressView.ListViewJobsData(Sender: TObject; Item: TListItem); 291 287 begin 292 288 if (Item.Index >= 0) and (Item.Index < JobProgressView.Jobs.Count) then 293 with TJob(JobProgressView.Jobs[Item.Index])do begin289 with JobProgressView.Jobs[Item.Index] do begin 294 290 Item.Caption := Title; 295 291 if Item.Index = JobProgressView.CurrentJobIndex then Item.ImageIndex := 1 … … 403 399 I := 0; 404 400 while I < Jobs.Count do 405 with TJob(Jobs[I])do begin401 with Jobs[I] do begin 406 402 CurrentJobIndex := I; 407 CurrentJob := TJob(Jobs[I]);403 CurrentJob := Jobs[I]; 408 404 JobProgressChange(Self); 409 405 StartTime := Now; … … 418 414 Method(CurrentJob); 419 415 end else begin 416 Thread := TJobThread.Create(True); 420 417 try 421 Thread := TJobThread.Create(True);422 418 with Thread do begin 423 419 FreeOnTerminate := False; … … 492 488 if AValue = FTerminate then Exit; 493 489 for I := 0 to Jobs.Count - 1 do 494 TJob(Jobs[I]).Terminate := AValue;490 Jobs[I].Terminate := AValue; 495 491 FTerminate := AValue; 496 492 end; … … 618 614 procedure TProgress.Increment; 619 615 begin 620 try621 FLock.Acquire;616 FLock.Acquire; 617 try 622 618 Value := Value + 1; 623 619 finally … … 628 624 procedure TProgress.Reset; 629 625 begin 630 try631 FLock.Acquire;626 FLock.Acquire; 627 try 632 628 FValue := 0; 633 629 finally … … 676 672 destructor TJob.Destroy; 677 673 begin 678 Progress.Free;674 FreeAndNil(Progress); 679 675 inherited; 680 676 end;
Note:
See TracChangeset
for help on using the changeset viewer.