private void ClearLog(EventLog log) { log.Clear(); EventLogViewer child = FindChildForLog(log); if (child != null) { child.BringToFront(); child.Focus(); child.RefreshGrid(); } }
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; }