we have a dashboard application that presents data according to dynamically executed SQL read from a database.
Up to now application connects to the database, loops against the grids (that present data), reads their SQL source, executes the SQL, presents the results in DataGridViews and then goes to next grid.
This is ok with few fast-responding grids but now we 've come up to a situation that from the moment that the user clicks the application to open until the window (fully loaded with data) is actually shown takes 2 - 3 mins.
Initially, I thought that solution is to put a "BackgroundWorker", for each run of this loop, in the background so that window pops-up immediately after the user starts the application and grids are presented as soon as they are fully loaded.
The tricky thinks here are:
1. the code that the thread needs to run is a dynamically build SQL which is not known at compile time so no "DoWork()" function can be written.
2. Even more, the number of grids is unknown at compile time so no effective number of threads that need to be used can be guessed in order for them to be declared.
Any ideas on how this should be treated in terms of architecture?
Is the "BackGroundWorker" the way to go?
Thanks in advance,