I have a WinForm app(.net 3.5) that when you first select a Person it retrieves all of that persons data for there entire Plan. This can take up to 5 secs. I need to show my users(in house only) that the program is loading/working in some way. I also need to keep them at that screen until it finishes as well. Do to the design of the app they could jump to any number of places in the App.
I thought maybe a Background Worker
is what I want but because I want them to stay where they are until it loads I am no longer sure(???).
What my App is doing is populating ~ 20 User Controls. Each User Control queries a Local SQL Express DB for it's information. So I have a method on my Parent Form that goes through and 'Paints' all开发者_如何学Go the User Controls and that is what they are waiting for.
Ideas? What's my best bet.
You could create a ProgressBarForm that has a progress bar. Do a ShowDialog to make it modal.
And subscribe to the ReportProgress of the BackgroundWorker to make your progress bar progress.
BackgroundWorker
is a sound choice, go for it - it's designed for scenarios such as you describe.
How about a locked modal window with a progressbar that changes on events thrown by the backgroundworker? Winforms isn't really my bag but something like this could work.
精彩评论