Ignore:
Timestamp:
Apr 25, 2022, 6:22:53 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Update Common package to version 0.10.
  • Modified: fgl unit replaced by Generics.Collections.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/UJobProgressView.pas

    r423 r424  
    55uses
    66  SysUtils, Variants, Classes, Graphics, Controls, Forms, Syncobjs,
    7   Dialogs, ComCtrls, StdCtrls, ExtCtrls, Contnrs, UThreading, Math,
     7  Dialogs, ComCtrls, StdCtrls, ExtCtrls, Generics.Collections, UThreading, Math,
    88  DateUtils;
    99
     
    6969  end;
    7070
    71   TJobs = class(TObjectList)
     71  TJobs = class(TObjectList<TJob>)
    7272  end;
    7373
     
    103103    procedure ReloadJobList;
    104104    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    105     procedure FormDestroy(Sender: TObject);
    106105    procedure ListViewJobsData(Sender: TObject; Item: TListItem);
    107106    procedure TimerUpdateTimer(Sender: TObject);
     
    163162  SExecuted = 'Executed';
    164163
     164
    165165implementation
    166166
     
    284284end;
    285285
    286 procedure TFormJobProgressView.FormDestroy(Sender:TObject);
    287 begin
    288 end;
    289 
    290286procedure TFormJobProgressView.ListViewJobsData(Sender: TObject; Item: TListItem);
    291287begin
    292288  if (Item.Index >= 0) and (Item.Index < JobProgressView.Jobs.Count) then
    293   with TJob(JobProgressView.Jobs[Item.Index]) do begin
     289  with JobProgressView.Jobs[Item.Index] do begin
    294290    Item.Caption := Title;
    295291    if Item.Index = JobProgressView.CurrentJobIndex then Item.ImageIndex := 1
     
    403399    I := 0;
    404400    while I < Jobs.Count do
    405     with TJob(Jobs[I]) do begin
     401    with Jobs[I] do begin
    406402      CurrentJobIndex := I;
    407       CurrentJob := TJob(Jobs[I]);
     403      CurrentJob := Jobs[I];
    408404      JobProgressChange(Self);
    409405      StartTime := Now;
     
    418414        Method(CurrentJob);
    419415      end else begin
     416        Thread := TJobThread.Create(True);
    420417        try
    421           Thread := TJobThread.Create(True);
    422418          with Thread do begin
    423419            FreeOnTerminate := False;
     
    492488  if AValue = FTerminate then Exit;
    493489  for I := 0 to Jobs.Count - 1 do
    494     TJob(Jobs[I]).Terminate := AValue;
     490    Jobs[I].Terminate := AValue;
    495491  FTerminate := AValue;
    496492end;
     
    618614procedure TProgress.Increment;
    619615begin
    620   try
    621     FLock.Acquire;
     616  FLock.Acquire;
     617  try
    622618    Value := Value + 1;
    623619  finally
     
    628624procedure TProgress.Reset;
    629625begin
    630   try
    631     FLock.Acquire;
     626  FLock.Acquire;
     627  try
    632628    FValue := 0;
    633629  finally
     
    676672destructor TJob.Destroy;
    677673begin
    678   Progress.Free;
     674  FreeAndNil(Progress);
    679675  inherited;
    680676end;
Note: See TracChangeset for help on using the changeset viewer.