static void mainForm_Load(object sender, EventArgs e) { //close splash if (splashScreen == null) { return; } splashScreen.Invoke(new Action(splashScreen.Close)); splashScreen.Dispose(); splashScreen = null; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //show splash Thread splashThread = new Thread(new ThreadStart( delegate { splashScreen = new Main_Module.SplashScreen(); Application.Run(splashScreen); } )); splashThread.SetApartmentState(ApartmentState.STA); splashThread.Start(); //run form - time taking operation MainForm mainForm = new MainForm(); mainForm.Load += new EventHandler(mainForm_Load); Application.Run(mainForm); }