Rank: Member Groups: Member
Joined: 8/23/2007 Posts: 12
|
Hi,
I am trying to use the progress bar to perform a long server side task.
I see the example included in the documentation, but it is just an inline code within the Run Task.
I am developing my project using a 3-tier model so the task is a method of a Manager object, so I don't understand quite well how to implement the RunTask Handler to update the progress bar without injecting in the Manager method references to EO.Web.ProgressTaskEventArgs.
Could you send me an example?
Thanks....Antonio
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Antonio,
When you handle RunTask, you must repeatly call e.UpdateProgress to update progress information. The progress bar does move by itself. You must drive it.
So if you have a function that runs the whole task and does not return until it is done, it will not work with the progress bar because the progress bar never get any progress information when your task is running. In order to do that, you must modify your function. Essentially you need to break the big task into small taskes. For example, Copy a whole file is a big task. However, you can break it into copying chunks. After copying each chunk, you would call e.UpdateProgress to update the progress information.
If that is not possible for you, then you will not be able to provide accurate progress information to the client. The only option left to you is to fake the progress. In that case, you can use some Javascript code to fake it completely on client side, but you will still need some code to trigger the server side task (a CallbackPanel will do); or still use RunTask, but let runTask to spawn another thread to run the real task. Either case it will bring you other headaches that are related to multi-threading. So the "correct" way is still modify your function to provide progress information.
Thanks
|