IsBusy set to false after OnRefreshed in view model

IsBusy set to false after OnRefreshed in view model

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


patelravij@gmail.com posted on Friday, May 18, 2012

Hi,

I am using silverlight CSLA ViewModel. I am facing issue when set IsBusy property after OnRefreshed. I have set IsBusy property to true in override OnRefreshed method. It does not set. Then i have keep log _PropertyChanged event and i found that after completion of override OnRefreshed method, IsBusy property set back to false!!!

So it will does not show busy indicator. Does is there any implementation of isbusy in viewmodebase so it set busy after onrefreshed. or any work around. 

RockfordLhotka replied on Friday, May 18, 2012

OnRefreshed runs after the refresh operation is complete. I think that the IsBusy property is set to false after OnRefreshed is invoked, with the assumption that this is the point at which the refresh operation is totally complete (the refresh is done, and any of your code in OnRefreshed is also done).

Are you starting another asynchronous operation in the OnRefreshed overload?

patelravij@gmail.com replied on Saturday, May 19, 2012

Yes, Rocky. I am starting another asynchronous operation in OnRefreshed overload method to fetch look up data and other general setting. So I am setting IsBusy property true in OnRefreshed method. But it set false when OnRefreshed call completed. Is there any way to set Isbusy property?

Thanks.

RockfordLhotka replied on Saturday, May 19, 2012

No, the behavior of the base class is as I described.

If you need your viewmodel to work differently, you should probably just not use the CSLA base class, but instead should create your own.

JonnyBee replied on Saturday, May 19, 2012

Have you considered to create a readonly object for "Unit of Work" loader that will fetch both lookupdata and business object in the same dataportal call.

This will greatly simplify your code and need only one async operation to complete.
Plus - you need the lookupdata BEFORE you hook up the data object in databinding so having this handled in a "UseCaseFetcher" is preferred foverstarting new async operations in OnRefreshed.

Se this thread too:http://forums.lhotka.net/forums/p/10508/49556.aspx#49556

Copyright (c) Marimer LLC