protected override void OnClosing(CancelEventArgs e) { // Save grid column widths. EventViewerSettings settings = ((MainForm)MdiParent).Settings; settings.DetailColumnWidths = panes.gridDetails.SaveColumnWidths(); settings.ParameterColumnWidths = panes.gridParameters.SaveColumnWidths(); base.OnClosing(e); }
public void DisplayMessage(EventMessage eventMessage, int eventMessageIndex, Image largeIcon, Image smallIcon) { const int MaxTitleBarMessageLength = 200; Debug.Assert(eventMessage != null && largeIcon != null && smallIcon != null, "eventMessage != null && largeIcon != null && smallIcon != null"); Debug.Assert(MdiParent != null, "MdiParent != null"); m_eventMessage = eventMessage; m_eventMessageIndex = eventMessageIndex; Icon = ImageToIcon(smallIcon); picEventIcon.Image = largeIcon; tipLog.SetToolTip(picEventIcon, eventMessage.Event); using (new LongRunningMonitor(this)) { panes.txtMessage.Text = eventMessage.Message; Text = "\"" + TextUtil.TruncateText(eventMessage.Message, MaxTitleBarMessageLength) + "\" (Event Message)"; // Save the currently expanded rows in the Details grid. panes.gridDetails.SaveExpandedRows(ref m_expandedDetails); EditorManager editorManager = ((MainForm)MdiParent).EditorManager; panes.gridDetails.EditorManager = editorManager; panes.gridParameters.EditorManager = editorManager; panes.gridDetails.DisplayValue(GetMessageProperties(eventMessage)); panes.gridParameters.DisplayValue(GetMessageParameters(eventMessage)); // Restore the grid column widths in the settings object. This must be done after displaying values. EventViewerSettings settings = ((MainForm)MdiParent).Settings; panes.gridDetails.RestoreColumnWidths(settings.DetailColumnWidths); panes.gridParameters.RestoreColumnWidths(settings.ParameterColumnWidths); // Restore the expanded rows in the Details grid, so that if the message being displayed // has the rows with the same names as the previous message it appears to the user that only the // values have changed. panes.gridDetails.RestoreExpandedRows(m_expandedDetails); } }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } if (m_settings != null) { m_settings.SettingChanged -= m_settings_SettingChanged; m_settings = null; } } base.Dispose(disposing); }
public void Initialise(LogForm parentForm) { // Apply settings. m_settings = ((MainForm)MdiParent).Settings; m_settings.DetailsWindow.ApplyToWindow(this); panes.SplitRatioTop = m_settings.DetailsSplitterRatioTop; panes.SplitRatioBottom = m_settings.DetailsSplitterRatioBottom; panes.gridDetails.EditorDialogSettings = m_settings.GenericEditorWindow; panes.gridParameters.EditorDialogSettings = m_settings.GenericEditorWindow; m_timeZone = m_settings.DisplayTimeZone; m_parentForm = parentForm; m_settings.SettingChanged += m_settings_SettingChanged; m_initialised = true; }