Search code examples
c#progress-barmulti-tier

Designing Multi-Tier application to use progress bar


I have a multi tier application in c# that is supposed to perform tasks on a database (If first time use, we may create the database and fill it with some data). When I initially designed the application I didn't account for a possible progress bar control, let alone any reporting of progress of any sort. How can I modify the design of the application to be able to report database operations progress to the UI layer? Is there a solution out there that is reusable and doesn't force me to modify all my functions to take additional inputs for the reporting?


Solution

  • No. Depending on how large your application is, you have a lot of work ahead of you.

    For progress reporting to work, you need the code which is performing the work to raise events when a unit of work is completed. That event needs to be handled at the UI layer and progress indicators updated.

    A good place to start would be to look into using BackgroundWorker (there is an example on MSDN here - http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx). Once you're familiar with the BackgroundWorker you should be in a better position to decide which changes you need to make to your application.