Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CreateAnonymousThread Usage?
#5
(02-14-2019, 09:41 PM)Alexandre Machado Wrote: You can have a look at IWMonitor. There is a demo here:

https://github.com/Atozed/IntraWeb/tree/...IWMonitor2

IWMonitor is a kind of "lightweight" timer with a few more options. The good thing about it is that it doesn't lock the user session session.

IWMonitor basically watches a WebApplication property (named "Status") for changes. Whenever Status change, it will trigger an event. When the status equals a "target" value it also trigger events and you can respond to that.

Please have a look and let me know if you need further help

IWMonitor did exactly what I needed.

Code:
  IWMonitor1.Enabled := true;

  tthread.CreateAnonymousThread(
    procedure
    begin
      salesSearchRequest.Execute;
      webapplication.Status.Value := 100;
    end).Start;

Code:
procedure TIWForm117.IWMonitor1AsyncTimer(Sender: TObject; EventParams: TStringList);
var
  idx: integer;
begin
  webapplication.Status.Value := 0;
  IWMonitor1.Enabled := false;
  if assigned(salesProSearchRequest) then
   begin
    doStuff;
    iwmemo1.lines.add('Finished');
   end;
end;

Knowing I can do that... makes things pretty interesting Smile

Since I use tthread.CreateAnonymousThread all the time now for iOS/Android usage in FMX, I make a huge fan of it.

Thanks for the heads up!
Reply


Messages In This Thread
CreateAnonymousThread Usage? - by cpstevenc - 02-13-2019, 08:33 PM
RE: CreateAnonymousThread Usage? - by kudzu - 02-14-2019, 02:31 PM
RE: CreateAnonymousThread Usage? - by cpstevenc - 02-14-2019, 02:42 PM
RE: CreateAnonymousThread Usage? - by cpstevenc - 02-15-2019, 05:49 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)