I’m writing a WP7 app which gets website information using WebClient‘s DownloadStringAsync method. The DownloadStringCompletedEventHandler parses the text before it gets displayed.
Take for example:
foo() {
...
getAllTheWebsiteInfo()
...
// display the downloaded, parsed text [1]
...
}
getAllTheWebsiteInfo() {
...
DownloadStringAsync()
...
}
The problem I’m running into is that at point [1] the text is empty (default value).
Is there a way for foo() to know when DownloadStringCompletedEventHandler has completed parsing the text so that at that point I can properly display the downloaded, parsed text?
Instead of setting the text in your
foomethod, you should just call the method which updates the UI at the end of your event handler, like this:instead of your approach, which essentially is like this: