void eventLogViewer_Click ( object sender, EventArgs e ) { if ( EventLogViewer.Visible ) { EventLogViewer.Focus ( ) ; } else { EventLogViewer.Show ( this ) ; } }
private void OpenChild(EventLog log) { this.Enabled = false; EventLogViewer viewer = FindChildForLog(log); if (viewer != null) { viewer.BringToFront(); viewer.Focus(); } else { EventLogViewer form = null; try { form = new EventLogViewer(log); if (!form.IsDisposed) { this.AddOwnedForm(form); form.MdiParent = this; form.Show(); form.BringToFront(); form.Focus(); } } catch (Exception ex) { MessageBox.Show("Failed to open Event Log : " + ex.Message, "Smoothy", MessageBoxButtons.OK, MessageBoxIcon.Error); if (form != null) { form.Close(); } } } this.Enabled = true; }
private void OpenChild(EventLog log) { this.Enabled = false; EventLogViewer viewer = FindChildForLog(log); if (viewer != null) { viewer.BringToFront(); viewer.Focus(); } else { EventLogViewer form = null; try { form = new EventLogViewer(log); if (!form.IsDisposed) { UITabPage tab = new UITabPage(log.LogDisplayName); tab.Controls.Add(form); form.Dock = DockStyle.Fill; this.uiTab1.TabPages.Add(tab); form.Show(); form.BringToFront(); form.Focus(); } } catch (Exception ex) { MessageBox.Show("Failed to open Event Log : " + ex.Message, "Smoothy", MessageBoxButtons.OK, MessageBoxIcon.Error); } } this.Enabled = true; }