Reporting progress across the layers

Reporting progress across the layers

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


bgilbert posted on Wednesday, August 19, 2009

I'm trying to find a way to report progress to a progressbar in my UI as objects are hydrated in the dataportal layer. Is there a simple way to do this?

tmg4340 replied on Thursday, August 20, 2009

There really isn't a good way to do this.  IIRC, this has been asked a few times on the forum, and I don't remember seeing any real good suggestions.  If your DP is running locally, you could create an event aggregator that your UI and BO's could talk to (and I would definitely use one, to help keep this stuff loosely coupled.)  But I wouldn't necessarily consider that a good idea, primarily because it won't work if/when you go to a remote DP.  Once you start writing code like that, you begin to lose one of the benefits of CSLA - location independence.

Is there a reason that a busy animation won't work?

- Scott

bgilbert replied on Thursday, August 20, 2009

Scott,

Thanks for your reply.

We currently run our Data Portal locally, but have plans to do remote sometime soon.

We have hourglasses for all fetches, but with larger fetches, the user sometimes assumes that the app is "hung". With a progressbar, we can show progress and they'll understand that something is actually happening.

I suppose I could fetch a count first and warn them if it exceeds a certain threshold.

Barry

tmg4340 replied on Thursday, August 20, 2009

You could certainly do a fetch, though that's obviously going to be one more touch to the database.  It's not a big one, but in a remote-DP environment, you may notice the delay.

I'd also consider my "busy animation" suggestion.  You could leverage your progressbar idea and use an "indeterminate progress bar" - one that increments based on a time interval rather than actual progress.  I know that probably none of us are fans of those (thank you, Microsoft installs), but it does have its uses if handled correctly.  I find the "cylon marquee" style works OK in this case.  Or you can use one of the many animations available - depending on your version of CSLA and UI technology, there's one in CSLA you could probably leverage.  Basically, anything that moves is going to be better than just a static hourglass, and you won't have to hit the database twice.

HTH

- Scott

JonnyBee replied on Thursday, August 20, 2009

Hi,

I agreee with the others answers above.

In our solutions we use an animated gif on the status bar (and use the asyncronous dataportal for fetches) to allow the animated gif to run.

And if the fetch takes more than 3 seconds we show a small splash screen with information about loading data.

We made this as an extender control to the WinForms statusbar. I might be able to share this into the CslaContrib project if it is of interest.
 
/jonnybee 

Copyright (c) Marimer LLC