Why you need Splash Screen (Cold Start & Warm Start)?
This is very important to know why you need splash screen. Basically when WPF window loads for the first time, which is basically called as Cold Start; the WPF framework needs to load pages required such as code, static data, registry etc. Those are not present in memory whenever the application framework loads after reboot. So, user will find at least 4 seconds are required to load the window for the first time. This is very annoying on the part of the user. User might double click on the window for more than once just after seeing the delay of load. This delay will not occur for the next time onwards when all the necessary framework elements are already loaded into memory, popularly known as Warm start.
So it is very essential to load a splash screen, so that user will see that the application has already started loading.
How to create Splash Screen ?
Splash screen should be created using Unmanaged Code. This is very important. We create splash screen to give the user an indication that the application has started loading. So if we do this using WPF code, there will be a delay in loading the splash screen as well, which is not what we needed.
Steps to create SPLASH SCREEN :
- Create your own WPF application.
- Create an image which you want to display when the application loads up.
You must remember, creating splash screen this way will make the splash screen static. That means you cannot interact with the splash screen in this way. I will discuss a better way to create splash screen later. - Add a the image in to your application.
- Select the Image and from properties window choose Build action as Splash Screen as shown in the figure.
- You are done. You can now run your application, and you will see the splash screen to appear before the application loads up.
This is the easiest approach of creating a splash screen. The image will be loaded using GDI unmanaged code before the WPF framework modules are fully loaded. So you can see this only when the application is loading. Once the Application is successfully run, the Splash screen will automatically disposed.
Download the source code from here.
Thank you for reading.
No comments:
Post a Comment
Please make sure that the question you ask is somehow related to the post you choose. Otherwise you post your general question in Forum section.