I am currently working on a project where we have a couple very control heavy user controls that are being used inside a MDI Controller. This is a Line of Business app and it is very data driven.
The problem that we were facing was the aforementioned controls would load very very slowly, we dipped our toes into the waters of multi-threading for the control loading but that was not a solution for a plethora of reasons. Our solution to increasing the performance of the controls ended up being to 'pre-load' the forms onto a hidden window, create a stack of the existing forms, and pop off of the stack as the user requested a form.
Now the current issue that I'm seeing that will arise as we push this 'fix' out to our testers, and the ultimately our users is this:
Currently the 'hidden' window that contains the preloaded forms is visible in task manager, and can be shut down thus causing all of the controls to be lost. Then you have to create them on the fly losing the performance increase. Secondly, when the user uses up the stack we lose the performance increase (current solution to this is discussed below).
For the first problem, is there a way to hide this window from task manager, perhaps by creating a parent form that encapsulates both the main form for the program and the hidden form?
Our current solution to the second problem is to have an inactivity timer that when it fires checks the stacks for the forms, and loads a new form onto the stack if it isn't full. However this still has the potential of causing a hang in the UI while it creates the forms. A possible solutions for this would be to put 'used' forms back onto the stack, but I feel like there may be a better way.
EDIT: For control design clarification
From the comments I have realized there is a lack of clarity on what exactly the control is doing.
Here is a detailed explanation of one of the controls.
I have defined for this control loading time as the time it takes from when a user performs an action that would open a control, until the time a control is accessible to be edited.
The control is for entering Prescriptions for a patient in the system, it has about 5 tabbed groups with a total of about 180 controls. The user selects to open a new Prescription control from inside the main program, this control is loaded into the MDI Child area of the Main Form (which is a DevExpress Ribbon Control). From the time the user clicks New (or loads an existing record) until the control is visible. The list of actions that happens in the program is this:
The stack is checked for the existence of a control. If the control exists it is popped off of the stack. The control is rendered on screen. This is what takes 2 seconds The control then is populated with a blank object, or with existing data. The control is ready to use.
The average percentage of loading time, across about 10 different machines, with different hardware the control rendering takes about 85 - 95 percent of the control loading time.
Without using the stack the control takes about 2 seconds to load, with the stack it takes about .8 seconds, this second time is acceptable.
I have looked at Henry's link and I had previously already implemented the applicable suggestions.
Again I re-iterate my question as What is the best method to move controls to and from the stack with as little UI interruption as possible?