constructor CAutoDemo.create;
begin
fSs:=TQueue<TScript>.Create;
fTimer:=TTimer.Create(Application);
fTimer.OnTimer:=self.Timer1Timer;
end;
destructor CAutoDemo.Destroy;
begin
fSs.Free;
inherited;
end;
procedure CAutoDemo.Timer1Timer(Sender: TObject);
var
i: Integer;
par: Integer;
script: CAutoDemo.TScript;
begin
if fSs.Count>0 then begin
script:=fSs.Peek();
par:=script.Key();
if par<>0 then begin
fTimer.Enabled:=False;
if script.Value(par) then
fSs.Dequeue;
fTimer.Enabled:=True;
end;
script.key:=nil;
script.Value:=nil;
end
else begin
fTimer.Enabled:=False;
end;
end;