private void logOutToolStripMenuItem_Click(object sender, EventArgs e) { byte Option = 0; //Ask for user confirmation before close the application Option = Convert.ToByte(MessageBox.Show("Do you want to Log Out?", "Log Out", MessageBoxButtons.YesNo, MessageBoxIcon.Question)); if (Option == 6) { Login.UserLogout(); bLogOut = true; FormLogin frmLogin = new FormLogin(); frmLogin.Show(); this.Close(); } }
private void timer1_Tick(object sender, EventArgs e) { progressBarLoading.PerformStep(); if (progressBarLoading.Value >= 100) { progressBarLoading.Value = 100; timer1.Enabled = false; //Make sure I am kept hidden WindowState = FormWindowState.Minimized; ShowInTaskbar = false; Visible = false; FormLogin frmLogin = new FormLogin(); frmLogin.TopMost = true; //since we open it from a minimezed window - it will not be focused unless we put it as TopMost. frmLogin.Show(); frmLogin.Activate(); frmLogin.TopMost = false; } }