The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

Pattern for waiting until/chaining dependant async operations RRS feed

  • General discussion

  • Hey All

    Im writing an application which authenticates with a webservice upon loading. 
    Once it's authenticated it should load all the relevant info. 
    1. Open App
    2. Authenticates with ws - gets authentication token
    3. Loads additional data with authentication token - into an observable object for display in a pivot.

    Im new to the silverlight way of programming, but I'm wondering what pattern to use to signal that other operations can commence (some UI some not).
    I know I dont want to use the wait command.

    This is pretty new to me so any help would be appreciated...maybe:
    • Begin Invoke and set an object on the application?
    • Some kind of observable object.
    • Some kind of chain of actions
    • An event of some kind

    Tuesday, May 8, 2012 4:36 AM

All replies

    • Some kind of chain of actions

    From what you described, this sounds like what you are looking for.  
    1. Fire the authentication request.
    2. When the authentication request is finished fire off the data request(s).
    3. Use Dispatcher to update the UI elements when the data request(s) is/are complete.
    Use some sort of progress bar to let the users know that the application is waiting for data.

    Tuesday, May 8, 2012 7:25 AM
  • Hey

    Yup that's what I was looking for a pattern for. 
    I've written a lazy loader using callbacks from the async methods and raises a prop change event.
    Just got to test it properly!

    That should do until the async framework comes through.

    Monday, May 14, 2012 12:02 PM