private void CloseMenuItem_Click(object sender, EventArgs e) { if (this.ActiveMdiChild is LogForm) { logging.Close(); logging.Dispose(); logging = null; } else if (this.ActiveMdiChild != null) { this.ActiveMdiChild.Close(); } }
private void CloseMenuItem_Click(object sender, EventArgs e) { try { if (this.ActiveMdiChild is LogForm) { logging.Close(); logging.Dispose(); logging = null; } else { using (Viewer child = (Viewer)this.ActiveMdiChild) { child.Close(); } System.GC.Collect(); } } catch { } }
private void ToggleLogging() { if (logging == null) { logging = new LogForm(); logging.MdiParent = this; logging.WindowState = FormWindowState.Maximized; logging.Show(); } else { logging.Close(); logging.Dispose(); logging = null; } LoggingToolStripMenuItem.Checked = (logging != null); }
private void ShowLogForm(string logPath) { if (logForm != null) { logForm.Activate(); } else { logForm = new LogForm(logPath); logForm.Show(); logForm.Activate(); logForm.FormClosed += (s, e) => { logForm.Dispose(); logForm = null; Utils.ReleaseMemory(true); }; } }
//显示登录窗口 public string ShowLogForm(string caption) { LogForm frmlogform = new LogForm(); frmlogform.Text = System.Convert.ToString(rms_var.apptitle + frmlogform.Text + caption); frmlogform.ShowDialog(); string str = ""; if (frmlogform.DialogResult == System.Windows.Forms.DialogResult.OK) //登录成功 { str = frmlogform.TextBox1.Text; //返回成功登录的操作员ID } else if (frmlogform.DialogResult == System.Windows.Forms.DialogResult.Cancel) //退出系统 { str = "-1"; } return(str); frmlogform.Dispose(); }