Splash Screen

Topics: CAB & Smart Client Software Factory
Feb 15, 2006 at 5:53 PM
originally posted by: SybizSE

How would you implement a splash screen?
Feb 16, 2006 at 7:40 AM
originally posted by: ChrisHolmes

We actually have a type of splash screen in our application. It's a login splash screen. After successful login it launches the CAB Shell. Failure (after three tries) closes the app.

If you just want a Splash screen with no authentication an easy way to do it is to create a Form that shows your splash, like MySplashScreen. Set it up to return a Dialog value (DialogResult.OK).

Then, in the ShellApplication.cs file you'll find the Main() thread and the line that reads:

new ShellApplication().Run();

What you can do then is prior to that line execute your Splash screen, like so:

MySplashScreen splash = new MySplashScreen();
splash.StartPosition = FormStartPosition.CenterScreen;
if(splash.DialogResult == DialogResult.OK){
new ShellApplication().Run();

This will launch your SplashScreen before the CAB Shell starts. The Splash will stay active until the user clicks a button that returns the DialogResult. You could also put a timer on the Dialog instead and have it auto-close after a certain amount of time, or whatever you want to do.
Feb 16, 2006 at 8:10 AM
originally posted by: sklett

This raises a question for me. I typically use a splash screen while I'm actually doing something, like hitting teh DB or checking/initializing hardware, etc, etc. I show the splash screen in one thread, proceed with my application initialization, then when everything is wrapped up, I kill the splash thread and show my main form. In a traditional WinForms app, this is really easy, but in CAB, I'm not sure you could do this?

You have to call FormShellApplication.Run() to load the modules and the modules are where the work is :) But FormShellApplication.Run() will also show the Shell form.

Is there a simple solution to this that I'm not seeing? I have looked at some of the FormShellApplication events, but I'm not seeing anything that would work for this case.

Ideas anyone?
Feb 16, 2006 at 8:28 AM
originally posted by: ChrisHolmes

You should be able to do certain things before the Shell shows itself.

You can override BeforeShellCreated() method in the ShellApplication to perform any startup code. You could use that overridden method to show your splash screen while you do other operations.