There are different solutions.
Basically you are gettign Quotes in a loop, You want that once a loop should complete and work is done only when it should recall from the begining.. Right
1) You can remove Asynchronous stuff from your code (but it'll halt the GUI, it depends on the requirement where you need this. if it has to be used in Windows Service or Console Application then this solution is ok. But even you have to do it within a Windows Application you can use BackgroundWorker componenent to tun this piece of blocking code.
2) You can use your above code + besides using it in a loop create an event which should be raised when GetQuotes completes its work and in that event handler make another call to GetQoutes.......
There may be many other solution if you think.
Best Regards,
Rizwan
|