Hi Leonid,
ok, so I'm again totally wrong.
"await" means that the execution should NOT wait, but continue. Then it makes sense that the calling method must be flagged as "async".
But then after this call I should be able to loop with sleep statements until the background task is finished, doing somethings like this:
Code: Select all
self:_ListDirectory( cPath )
while _lSuccess == false
System.Diagnostics.Debug.WriteLine( "Waiting on ListDirectory" )
System.Threading.Thread.Sleep( 100 )
end
if _lSuccess
oReturn := _oEntryList
endif
But the strange thing is that the in the called method the code is never executed (I have traced that with Debug.WriteLine() calls):
Code: Select all
_lSuccess := false
System.Diagnostics.Debug.WriteLine( "creating task" )
oTask := _oClient:GetListing( cSearch, FtpListOption.AllFiles )
System.Diagnostics.Debug.WriteLine( "awaiting task" )
await oTask
System.Diagnostics.Debug.WriteLine( "task finished" )
_lSuccess := true
The "task finished" message never arrives, and the _lSuccess is never set to true.
Wolfgang