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(); } }
multithreading c # winforms splash-screen
Andy Nov 04 '09 at 12:45 2009-11-04 12:45
source share