As most of you probably know, a cold start of a .NET program takes a little bit to load. After that the warm starts come right up because all the .NET business is cached. My question is, is there anyway to have a splash screen come up as the .NET resources load so the user doesn't think the programs unresponsive and tries to keep opening it? I tried a normal splash that does all the loading before the main form comes up, but that only comes up after the fact, so its of little help. I looked into maybe using WPF but I couldn't find any solid info on how to implement this. Any help would be great, thanks guys!
(Using VS 2008 and .NET 4.0 but upgrading to 4.5, so answer referring to either works)
I'm trying to do something just like that, I'm trying to find a way to load just enough to get a splash screen up then load the rest while the the splash screen is up I just can't seem figure out how to do this.
I've tried putting it in main and showing it before anything else even loads then building the mainForm with the splash screen up. The delay is still there because I think (and I could be wrong) that its still loading the .NET components first in order to show that first splash screen. I can't seem to find a way to have it pop up right away.
Build a test project that only shows a splash screen and compare that with you load times. If that loads fast enough, then start disabling stuff from your app until you find the items that are slowing the app down. Move the loading of those items into another thread. P.S. Sleep(...) isn't going to help.
I did it in a Medical Imaging project - it was slow loading - once loaded it was fast - that was bcos we had to load all the images (scans) in memory for fast processing. But it wasn't at the startup, so people knew its coming up when the cursos shows hourglass and didnt click on it multiple times.
Maybe a good way to think of your program and loading is to think of a tree with a trunk and branches and to think that it takes time to compile and load the trunk and any branches.
Think of the trunk as the shell of your program. Branches are references that you 'new' up during startup which also need to be compiled and loaded.
For fastest loading what you want to try to accomplish is a tree with only a trunk (or a trunk with a couple of very small branches).
To this end, minimize the number of 'branches' by only 'new'ing up the branches that are absolutely necessary to get your program running.
For the non-essential startup branches, only new these up on-demand like when a user initiates some action, or load these in a separate thread and use a delegate to signal the user that everything has been loaded (this can be as simple as a status messages stating "loading..." and enabling menu items or buttons when completed).