Addins C# asynch task

Addins C# asynch task

Hi  dear support!

I have question how Zenon runtime works. I mean when i start Addin it works synchroniusly with main runtime task?
i have function like this 

i start "FuncToRun" - SCRIPT_ReportViewer export pdf function (if i start function "reportviewer_export_pdf" directly it does not work, work if i start script which include this function. propably if i start script , it works asynchroniusly) next i wait using while and DoEvents that fucntion reportvewer_export_pdf make pdf file 

Could you give me advice how do it better? i does not want use DoEvents()/

Maybe you have any  example how to use Asynch Task with zenon runtime?