protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); e.Cancel = true; FileStream writer = null; if (m_profileLocation != "") { if (m_createProfile) { writer = new FileStream(m_profileLocation, FileMode.Create, FileAccess.Write); try { BinaryFormatter binaryFormatter = new BinaryFormatter(); PlotOptions tmpPlotOptions = new PlotOptions(m_plotOptions); binaryFormatter.Serialize(writer, tmpPlotOptions); MainFormOptions tmpMainOptions = new MainFormOptions(m_mainFormOptions); binaryFormatter.Serialize(writer, tmpMainOptions); Options.FragmentLadderOptions tmpFragLadder = new Options.FragmentLadderOptions(m_fragLadderOptions); binaryFormatter.Serialize(writer, tmpFragLadder); } finally { writer.Close(); } } } this.Hide(); }
private void OptionsViewController_FormClosing(object sender, FormClosingEventArgs e) { //Lets Save the Profile data. FileStream writer = null; if (m_profileLocation != "") { if (m_createProfile) { writer = new FileStream(m_profileLocation, FileMode.Create, FileAccess.Write); try { BinaryFormatter binaryFormatter = new BinaryFormatter(); PlotOptions tmpPlotOptions = new PlotOptions(m_plotOptions); binaryFormatter.Serialize(writer, tmpPlotOptions); MainFormOptions tmpMainOptions = new MainFormOptions(m_mainFormOptions); binaryFormatter.Serialize(writer, tmpMainOptions); Options.FragmentLadderOptions tmpFragmentLadderOptions = new Options.FragmentLadderOptions(m_fragLadderOptions); binaryFormatter.Serialize(writer, tmpFragmentLadderOptions); } finally { writer.Close(); } } } }
public MainForm() { InitializeComponent(); m_currentOptions = new MainFormOptions(); m_manager = new Manager(this); //Fragment Ladder panelFragmentLadder.Controls.Add(m_manager.m_fragLadder); panelFragmentLadder.Controls[m_manager.m_fragLadder.Name].Dock = DockStyle.Fill; panelFragmentLadder.Resize += new EventHandler(panel_Resize); //Data View panelDataView.Controls.Add(m_manager.m_dataView); panelDataView.Controls[m_manager.m_dataView.Name].Dock = DockStyle.Fill; panelDataView.Resize += new EventHandler(panel_Resize); //Plot panelPlot.Controls.Add(m_manager.m_plot); panelPlot.Controls[m_manager.m_plot.Name].Dock = DockStyle.Fill; panelPlot.Resize += new EventHandler(panel_Resize); //////FileOpen ////FileOpen = new OpenMenu(); splitContainer2.IsSplitterFixed = false; splitContainer2.BorderStyle = BorderStyle.FixedSingle; splitContainer1.BorderStyle = BorderStyle.FixedSingle; splitContainer1.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; splitContainer2.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; detachPlotFromMainForm(); MainForm_Resize(this, null); Text = "Spectrum Look - " + GetAppVersion(); KeyDown += new KeyEventHandler(MainForm_KeyDown); KeyPreview = true; //set this true so we can get all the key events for child controls }
public MainFormOptions(MainFormOptions optionsToCopy) { m_isPlotInMainForm = optionsToCopy.isPlotInMainForm; m_toleranceValue = optionsToCopy.toleranceValue; m_lowerToleranceValue = optionsToCopy.lowerToleranceValue; }
public void CopyOptions(MainFormOptions optionsToCopy) { isPlotInMainForm = optionsToCopy.isPlotInMainForm; toleranceValue = optionsToCopy.toleranceValue; lowerToleranceValue = optionsToCopy.lowerToleranceValue; }