locked
Goto State Before Button Click Event RRS feed

  • Question

  • I have a process that takes 5 to 10 seconds.  I would like the UI to go to a specific state before processing.  Once completed, I want the UI to go to another state.  

    I added a GoToState behavior to the Button that runs the process.  The Button's click event includes the code that processes.  At the end of the event, I call the GoTo state to show either success or another for failure.

    How to you call and go to a state before processing the event without delays?

    Thursday, July 8, 2010 8:32 PM

All replies

  • do you have a processing state? you should probably call the gotostate method before you do all your processing, and at the end of that call the gotostate again to either success or fail state. if you're working with web services, you can check out this post http://www.silverlightshow.net/items/Tip-Asynchronous-Silverlight-Execute-on-the-UI-thread.aspx 
    Wednesday, July 14, 2010 1:45 PM
  • No web services, just local code that needs to query data and print labels on local machine ( this takes about 10 seconds ).  I have a GoTo behavior attached to button and a GoTo method at the end of the process (pass/fail state).

    When setup this way, the UI pauses and never goes to the state the behavior is set for.  It will only go to the state that is called at end of process.

    I got it working by just adding a BackgroundWorker, but seems that takes more code to do the job.  It would be nice to just drag/drop or one-liner code to do the trick without delays.

    Thanks for reply and link.

    Wednesday, July 14, 2010 2:37 PM