private void frmMainMenu_FormClosing(object sender, FormClosingEventArgs e) { bool bClosable = true; foreach (Form childForm in this.MdiChildren) { IFormClosable formClosable = childForm as IFormClosable; if (formClosable == null) { continue; } if (!formClosable.GetAllowClose()) { bClosable = false; break; } } if (!bClosable) { e.Cancel = true; return; } //========================================= if (m_exitMode != ExitModes.Logout) { // Request to terminate application. if (MessageDialog.ShowConfirmationMsg(this, Util.GetMessageText(eMsgId.COM0038)) == DialogButton.Yes) { // Force to exit application. m_exitMode = ExitModes.Terminate; e.Cancel = false; } else { // Cancel exit application. e.Cancel = true; } } }
public virtual void DoLogout() { //Check Open Form if (this.MdiChildren.Length > 0) { //Please close all screen before MessageDialog.ShowBusinessErrorMsg(this, Util.GetMessageText(eMsgId.COM0033)); } else { //Confirm: Do you want to logout? if (MessageDialog.ShowConfirmationMsg(this, Util.GetMessageText(eMsgId.COM0032)) == DialogButton.Yes) { m_exitMode = ExitModes.Logout; this.Close(); MainLogin.IsLogout = true; MainLogin.Show(); MainLogin.PerformLogin(); } } }