private void graphSpectrum_FormClosed(object sender, FormClosedEventArgs e) { // Update settings and menu check Settings.Default.ShowSpectra = false; _graphSpectrum = null; }
private GraphSpectrum CreateGraphSpectrum() { // Create a new spectrum graph _graphSpectrum = new GraphSpectrum(this); _graphSpectrum.UpdateUI(); _graphSpectrum.FormClosed += graphSpectrum_FormClosed; _graphSpectrum.VisibleChanged += graphSpectrum_VisibleChanged; _graphSpectrum.SelectedSpectrumChanged += graphSpectrum_SelectedSpectrumChanged; return _graphSpectrum; }
private void DestroyGraphSpectrum() { if (_graphSpectrum != null) { _graphSpectrum.FormClosed -= graphSpectrum_FormClosed; _graphSpectrum.VisibleChanged -= graphSpectrum_VisibleChanged; _graphSpectrum.SelectedSpectrumChanged -= graphSpectrum_SelectedSpectrumChanged; _graphSpectrum.HideOnClose = false; _graphSpectrum.Close(); _graphSpectrum = null; } }
public void ShowGraphSpectrum(bool show) { if (show) { if (_graphSpectrum != null) { _graphSpectrum.Activate(); _graphSpectrum.Focus(); } else { _graphSpectrum = CreateGraphSpectrum(); int firstDocumentPane = FirstDocumentPane; if (firstDocumentPane == -1) _graphSpectrum.Show(dockPanel, DockState.Document); else _graphSpectrum.Show(dockPanel.Panes[firstDocumentPane], DockPaneAlignment.Right, 0.5); } } else if (_graphSpectrum != null) { // Save current setting for showing spectra show = Settings.Default.ShowSpectra; // Close the spectrum graph window _graphSpectrum.Hide(); // Restore setting and menuitem from saved value Settings.Default.ShowSpectra = show; } }