Hi I am trying to use a background worker in my application.
I basically have a list of items displayed. When a user selects a particular item I have the background worker query the database to get information about the item selected and display it once it is done. (There are quite a few database calls) Since the
database queries might take time, I have a UI wait animation displayed while the data is getting fetched. Once the background worker is completed I get rid of the wait animation and display the information fetched. This setup works fine if I do not click on
any other item while the UI wait animation is being displayed. My main aim is to cancel the background worker from fetching the previously selected items information when a new item is selected (as the previous information would anyways be overwritten with
the new item's information). The problem with such an approach is within the background worker's doWork method i would need to continuously check after each database query if the cancellation is pending and if it is then I can cancel the rest of the queries.
I somehow feel this is not the right approach. If anyone has any suggestions about a better way to achieve the required functionality it would be great..
View Complete Post