static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FrmLogin()); Form fc = Application.OpenForms["FrmMainScreen"]; if (fc != null) { fc.Focus(); } else { FrmMainScreen frmMain = new FrmMainScreen(); frmMain.IsMdiContainer = true; frmMain.ShowDialog(); } // Application.Run(new FrmLogin()); //Form fc = Application.OpenForms["FrmMainScreen"]; //if (fc != null) //{ // fc.Focus(); //} //else //{ // FrmMainScreen frmMain = new FrmMainScreen(); // frmMain.IsMdiContainer = true; // frmMain.ShowDialog(); //} }
private void btnLogin_Click(object sender, EventArgs e) { if (ValidateForm()) { if (LoginAuth()) { // SetUsers(); fc = Application.OpenForms["FrmMainScreen"]; if (fc != null) { fc.Close(); fc.Dispose(); MainSubMenuLoad(); //this.Close(); // MainSubMenu(); FrmMainScreen frmMain = new FrmMainScreen(); frmMain.IsMdiContainer = true; frmMain.ShowDialog(); //fc.IsMdiContainer = true; //fc.Menu = menu; //fc.WindowState = FormWindowState.Maximized; //fc.Focus(); } else { this.Close(); } } else { MessageBox.Show("Invalid UserName/Password", GlobalVaribles.ProjectName, MessageBoxButtons.OK, MessageBoxIcon.Stop); } } //if (ValidateForm()) //{ // if (CheckUserPassword()) // { // SetUsers(); // fc = Application.OpenForms["FrmMainScreen"]; // if (fc != null) // { // fc.Close(); // fc.Dispose(); // MainSubMenu(); // FrmMainScreen frmMain = new FrmMainScreen(); // frmMain.IsMdiContainer = true; // frmMain.ShowDialog(); // } // else // { // this.Close(); // } // } // else // { // MessageBox.Show("Invalid UserName/Password", GlobalVaribles.ProjectName, MessageBoxButtons.OK, MessageBoxIcon.Stop); // } //} }