private void showLogToolStripMenuItem_Click(object sender, EventArgs e) { if (showLogToolStripMenuItem.Checked = !showLogToolStripMenuItem.Checked) {// need log if (formLog == null) { formLog = CreateShowFormLog(); } else { if (formLog.IsDisposed) { formLog = CreateShowFormLog(); } } } else { if (formLog == null) { return; } if (formLog.IsDisposed) { return; } formLog.Close(); } }
private void Form1_Load(object sender, EventArgs e) { if (Settings.Default.ShowLog) { formLog = CreateShowFormLog(); } connectToolStripMenuItem_Click(sender, e); }
private FormLog CreateShowFormLog() { FormLog formLog = new FormLog(); formLog.FormClosing += new FormClosingEventHandler(formLog_FormClosing); formLog.Show(); formLog.BringToFront(); return(formLog); }