What is a correct way to queue complex tasks in wp8?
The tasks consists of the following:
- Showing a
ProgressIndicator
through updating a model variable - Fetching or storing data to a wcf service (
UploadStringAsync
) - Updating potentially data bound model with the result from
UploadStringCompleted
. - Hiding the
ProgressIndicator
through updating a model variable
Currently I've been working with a class owning a queue of command objects, running a single thread that is started when an item is added if it's not already running.
I have however problems with waiting for tasks or subtasks where the code stops running.
Previously I've used async await, but a few levels down the behaviour was becoming more and more unpredictable.
What I want is the main thread being able to create and queue command objects. The command objects should run one at a time, not starting a new one until the previous one is completely finished. The command objects should be able to use the dispatcher to access the main thread if neccesary.