C # Best Practice Screen Screen Display Method

I am showing a splash shape, opening a new thread just before starting my main form.

In the method that this thread executes, I use Application.Run, as shown in Option 1 below. Is this the right way to do this, or is there a problem waiting for me because I called Application.Run twice? An alternative is option 2, also shown below, where I call .ShowDialog () to display the form.

The splash shape closes after a certain time, is controlled within the form itself, and both options work well.

So my question is: which is preferable - option 1 or option 2? If you could indicate specific reasons for one or the other, that would be great.

Thank.

A fragment of the main:

// Run splash screen thread. Thread splash = new Thread(new ThreadStart(ShowSplash)); splash.Start(); // Run main application. Application.Run(new MainForm()); 

Show spray shape 1:

  static void ShowSplash() { Application.Run(new SplashForm()); } 

Show spray shape 2:

  static void ShowSplash() { using (SplashForm splash = new SplashForm()) { splash.ShowDialog(); } } 
+7
multithreading c # winforms splash-screen
Nov 04 '09 at 12:45
source share
3 answers

Screensaver Screensaver until the thread completes

see top rated answer

+3
Nov 04 '09 at 13:00
source share

Option 2 is likely to run into a problem, because then you are using the same Mesageloop as MainForm, but from a different thread.

Option 1 is fine.

+3
Nov 04 '09 at 12:59
source share

I understand that this may be an unusual point of view, but you think that you are not using the Splash screen and instead display information on the "welcome" or "help> about" screen instead?

There are several reasons for this:

  • If you do not go into multithreading, the Splash Screen may not be redrawn properly if the / msgbox warning pops up over it, completely negating the advantage of the pop-up screen.

  • Screensavers that show that you have plugins installed x, y and z, can not say about it until this information is downloaded. By the time this information is downloaded, your application will be ready to work, so you will either close the splash screen or it will be in the user's path.

  • If I answer aside and skip the screen saver, I will skip any information that you tell me. If the "License validity after 3 days" is part of this information, and today is Friday, then I don’t understand that on Monday I can’t use the application. Unclear, but I saw it.

+1
Nov 04 '09 at 13:09
source share



All Articles