private void LoginToolStripMenuItem_Click(object sender, EventArgs e) { try { frmLogin frm = new frmLogin(); if (frm.ShowDialog() == DialogResult.OK) { HindMenu(); ShowTooStatus(); LoginToolStripMenuItem.Visible = false; LogoffToolStripMenuItem.Visible = true; frmAllRoom frmAR = new frmAllRoom(); if (frmAR.ShowDialog() == DialogResult.Yes) { LoginToolStripMenuItem.Visible = true; LogoffToolStripMenuItem.Visible = false; LoginToolStripMenuItem_Click(null, null); } } } catch (Exception ex) { Program.MessageError(ex.Source, ex.StackTrace, ex.Message); } }
private void LogoffToolStripMenuItem_Click(object sender, EventArgs e) { foreach (Form childForm in MdiChildren) { childForm.Close(); } ClearShowTooStatus(); Program.Logout(); LogoffToolStripMenuItem.Visible = false; LoginToolStripMenuItem.Visible = true; frmLogin frm = new frmLogin(); if (frm.ShowDialog() == DialogResult.OK) { HindMenu(); ShowTooStatus(); frmAllRoom frmAR = new frmAllRoom(); if (frmAR.ShowDialog() == DialogResult.Yes) { LoginToolStripMenuItem.Visible = true; LogoffToolStripMenuItem.Visible = false; LoginToolStripMenuItem_Click(null, null); } else { LoginToolStripMenuItem.Visible = false; LogoffToolStripMenuItem.Visible = true; } } }