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