private void mnuLogOff_Click(object sender, System.EventArgs e) { frmLogOff DR = new frmLogOff(); DR.ShowDialog(this); if(DR.DialogResult == DialogResult.Cancel) { return; } if(OSystem != null) OSystem.ReleaseResources(); // if(LoginUser != null) // LoginUser.ReleaseCameras(); if(FRMHelp != null) { if(FRMHelp.Visible == false) { FRMHelp = new frmHelp(); FRMHelp.Dispose(); } else FRMHelp.Dispose(); } DR.Dispose(); g_bAppClosing = true; Application.Exit(); //this.DialogResult = DialogResult.Cancel; }
private void toolBarMain_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) { switch(e.Button.Text) { case "Users": BuildUserHierarchy(); break; case "System": System_Properties SP = new System_Properties(); PassOysterSystemData POSD = new PassOysterSystemData(); POSD.LoginUser = LoginUser; POSD.OSystem = OSystem; SP.Tag = POSD; SP.ShowDialog(this); break; case "Help": //ShowDisplay(ShowHelpInfo); if(FRMHelp != null) { if(FRMHelp.Visible == true) { if(FRMHelp.WindowState == FormWindowState.Minimized) FRMHelp.WindowState = FormWindowState.Normal; else FRMHelp.WindowState = FormWindowState.Minimized; } else { FRMHelp.Dispose(); FRMHelp = new frmHelp(); FRMHelp.Show(); } FRMHelp.Focus(); } else { FRMHelp = new frmHelp(); FRMHelp.Show(); } break; case "Log Off": frmLogOff DR = new frmLogOff(); DR.ShowDialog(this); if(DR.DialogResult == DialogResult.Cancel) { return; } if(OSystem != null) OSystem.ReleaseResources(); // if(LoginUser != null) // LoginUser.ReleaseCameras(); Application.Exit(); break; default : //MessageBox.Show("This feature has not yet been implement."); break; } tbActionBar.Buttons[0].Visible = false; tbActionBar.Buttons[1].Visible = false; tbActionBar.Buttons[2].Visible = false; tbActionBar.Buttons[3].Visible = false; tbActionBar.Buttons[4].Visible = false; tbActionBar.Buttons[5].Visible = false; tbActionBar.Buttons[6].Visible = false; }
private void Form1_Closing_1(object sender, System.ComponentModel.CancelEventArgs e) { if(g_bAppClosing == false) { frmLogOff DR = new frmLogOff(); DR.ShowDialog(this); if(DR.DialogResult == DialogResult.Cancel) { e.Cancel = true; return; } UserLicense.Release(); if(OSystem != null) OSystem.ReleaseResources(); // if(LoginUser != null) // LoginUser.ReleaseCameras(); if(FRMHelp != null) { if(FRMHelp.Visible == false) { FRMHelp = new frmHelp(); FRMHelp.Dispose(); } else FRMHelp.Dispose(); } DR.Dispose(); } Trace.WriteLine("Logged Off",System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name); Application.Exit(); //this.DialogResult = DialogResult.Cancel; }