CSLA 3.8.1 ViewModelBase<T> - IsBusy usage

CSLA 3.8.1 ViewModelBase<T> - IsBusy usage

Old forum URL: forums.lhotka.net/forums/t/8012.aspx

Jack posted on Wednesday, November 18, 2009


In the ViewModelBase<T>.QueryCompleted and the callback in BeginSave you set IsBusy to False first off. 

I found that the rest of the processing is taking quite a while when pulling in lots of data so my UI is showing the IsBusy animation, then it stops, then the UI is frozen, then available again.

Is there a reason you do that?  Is the expectation that I should set/clear IsBusy myself in those other methods/events?

I see that SetProperties has some reliance on IsBusy but otherwise I was curious.



RockfordLhotka replied on Saturday, November 21, 2009

The QueryCompleted() method runs on the UI thread, so it doesn't really matter if IsBusy is set or not - the UI will lock at that point.

If you have some long processing you need to do against the Model after the query completes, you might consider starting that process in an OnRefreshed() override, but running it on your own background thread (I'd suggest you use the BackgroundWorker).

You can set IsBusy yourself - the property setter is protected - so you can use IsBusy when doing your own async operations too.

Copyright (c) Marimer LLC