Search code examples
windows-phone-7asynchronousmobile-application

Handling Asynchronous operations in Windows Phone7


I am developing a Windows Phone7 application in which I have two App bar buttons both when clicked makes Asynchronous calls to Web and Callbacks will be performed upon the Web response.

Now my problem is, if I click on one button and as the Async operation is going on in the background ans meanwhile if I click on another button both callbacks are executing one after the other, which is not good for obvious reasons. Could any one help me on how to handle this???

First I thought to disable other buttons when 1 Async operation is going. But it doesnt give good feel for user. So what will be the best way to handle this problem??


Solution

  • You can use a Flag variable and check its value within the async call complete method. Based on your requirement you can choose to update or not update the view.