private static void MainForm_LoadCompleted(object sender, EventArgs e) { if (frmSplash == null || frmSplash.Disposing || frmSplash.IsDisposed) { return; } frmSplash.Invoke(new Action(() => { frmSplash.Close(); })); frmMain.TopMost = false; frmSplash.Dispose(); frmSplash = null; if (Module.authentication.checkStatus()) { frmStudentList = new frmStudentList(); frmStudentList.MdiParent = frmMain; frmStudentList.Show(); } frmMain.Activate(); frmMain.Focus(); }
static void Main() { //Apply Style to MessageBoxAdv msgbAdv(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Show Splash Form frmSplash = new frmSplash(); if (frmSplash != null) { Thread splashThread = new Thread(new ThreadStart( () => { Application.Run(frmSplash); })); splashThread.SetApartmentState(ApartmentState.MTA); splashThread.Start(); } //Create and Show Main Form frmMain = new frmMain(); frmMain.LoadCompleted += MainForm_LoadCompleted; frmMain.TopMost = true; Application.Run(frmMain); frmMain.Focus(); frmMain.Activate(); }