Within each DocumentViewModel, there is an internal reference counter (held in the AbstractDocumentViewModel) which keeps track of how many things are currently in progress for that document.
When this counter > 0, the progress bar (or spinning busy graphic) is shown on that document.
In order to notify it that something is in progress (usually a service call or something which will take a detectable period of time to complete), within your DocumentViewModel class, you can call :
ProgressBarToggle(true);
And to notify that this action is finished with :
ProgressBarToggle(false);
The method ProgressBarToggle, is threadsafe and may be called on any thread. If it is called on the UI thread in direct response to a UI event such as a button click, then the method will take care of the fact that the UI would normally not update the progress bar visibility until the event handling method was complete & fork the thread to handle outstanding UI messages and binding updates, before continuing on with the functionality of the event handling method. In effect a VB-style “DoEvents” under the covers.
[Note : This has been added to the fledgling developer document in sharepoint :
.../Leisureflexdotnet/Design%2Documents/Forms/AllItems.aspx/“Sandstorm Developer Notes Braindump.docx”]
No comments:
Post a Comment