/* * OnFormClosing */ /// <summary> /// Raises the <see cref="E:System.Windows.Forms.Form.FormClosing"></see> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.FormClosingEventArgs"></see> that contains the event data.</param> protected override void OnFormClosing(FormClosingEventArgs e) { if (!_tabbedMdi.IsEmpty) { IList<Canvas> canvasList = new List<Canvas>(); foreach (NuGenTabPage tabPage in _tabbedMdi.TabPages) { Canvas currentCanvas = _tabbedMdi.FindCanvasOnTabPage(tabPage); if (currentCanvas != null && currentCanvas.SaveIsNeeded) { canvasList.Add(currentCanvas); } } if (canvasList.Count > 0) { using (SaveChangesForm saveChangesForm = new SaveChangesForm()) { foreach (Canvas canvas in canvasList) { saveChangesForm.AddDocument(canvas); } DialogResult dialogResult = saveChangesForm.ShowDialog(this); if (dialogResult == DialogResult.OK) { canvasList = saveChangesForm.GetCanvasCollection(); foreach (Canvas canvas in canvasList) { SaveSchema(canvas); } } else if (dialogResult == DialogResult.Abort) { e.Cancel = false; } else { e.Cancel = true; } } } } base.OnFormClosing(e); Settings.Default.MainForm_State = WindowStateTracker.GetWindowState(this); if (WindowState == FormWindowState.Normal) { Settings.Default.MainForm_Location = Location; Settings.Default.MainForm_Size = Size; } else { Settings.Default.MainForm_Location = RestoreBounds.Location; Settings.Default.MainForm_Size = RestoreBounds.Size; } Boolean propertiesFormIsVisible = _propertiesButton.Checked; Boolean toolboxFormIsVisible = _toolboxButton.Checked; Boolean outputFormIsVisible = _outputButton.Checked; Settings.Default.PropertiesForm_Visible = propertiesFormIsVisible; if (propertiesFormIsVisible) { Settings.Default.PropertiesForm_Location = _propertiesForm.Location; Settings.Default.PropertiesForm_Size = _propertiesForm.Size; } Settings.Default.ToolboxForm_Visible = toolboxFormIsVisible; if (toolboxFormIsVisible) { Settings.Default.ToolboxForm_Location = _toolboxForm.Location; Settings.Default.ToolboxForm_Size = _toolboxForm.Size; } Settings.Default.OutputForm_Visible = outputFormIsVisible; if (outputFormIsVisible) { Settings.Default.OutputForm_Location = _outputForm.Location; Settings.Default.OutputForm_Size = _outputForm.Size; } Settings.Default.MainForm_ExpressionHistory = new StringCollection(); foreach (Object expression in _expressionCombo.Items) { Settings.Default.MainForm_ExpressionHistory.Add(expression.ToString()); } Settings.Default.Save(); }
/* * OnFormClosing */ /// <summary> /// Raises the <see cref="E:System.Windows.Forms.Form.FormClosing"></see> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.FormClosingEventArgs"></see> that contains the event data.</param> protected override void OnFormClosing(FormClosingEventArgs e) { if (!_tabbedMdi.IsEmpty) { IList <Canvas> canvasList = new List <Canvas>(); foreach (NuGenTabPage tabPage in _tabbedMdi.TabPages) { Canvas currentCanvas = _tabbedMdi.FindCanvasOnTabPage(tabPage); if (currentCanvas != null && currentCanvas.SaveIsNeeded) { canvasList.Add(currentCanvas); } } if (canvasList.Count > 0) { using (SaveChangesForm saveChangesForm = new SaveChangesForm()) { foreach (Canvas canvas in canvasList) { saveChangesForm.AddDocument(canvas); } DialogResult dialogResult = saveChangesForm.ShowDialog(this); if (dialogResult == DialogResult.OK) { canvasList = saveChangesForm.GetCanvasCollection(); foreach (Canvas canvas in canvasList) { SaveSchema(canvas); } } else if (dialogResult == DialogResult.Abort) { e.Cancel = false; } else { e.Cancel = true; } } } } base.OnFormClosing(e); Settings.Default.MainForm_State = WindowStateTracker.GetWindowState(this); if (WindowState == FormWindowState.Normal) { Settings.Default.MainForm_Location = Location; Settings.Default.MainForm_Size = Size; } else { Settings.Default.MainForm_Location = RestoreBounds.Location; Settings.Default.MainForm_Size = RestoreBounds.Size; } Boolean propertiesFormIsVisible = _propertiesButton.Checked; Boolean toolboxFormIsVisible = _toolboxButton.Checked; Boolean outputFormIsVisible = _outputButton.Checked; Settings.Default.PropertiesForm_Visible = propertiesFormIsVisible; if (propertiesFormIsVisible) { Settings.Default.PropertiesForm_Location = _propertiesForm.Location; Settings.Default.PropertiesForm_Size = _propertiesForm.Size; } Settings.Default.ToolboxForm_Visible = toolboxFormIsVisible; if (toolboxFormIsVisible) { Settings.Default.ToolboxForm_Location = _toolboxForm.Location; Settings.Default.ToolboxForm_Size = _toolboxForm.Size; } Settings.Default.OutputForm_Visible = outputFormIsVisible; if (outputFormIsVisible) { Settings.Default.OutputForm_Location = _outputForm.Location; Settings.Default.OutputForm_Size = _outputForm.Size; } Settings.Default.MainForm_ExpressionHistory = new StringCollection(); foreach (Object expression in _expressionCombo.Items) { Settings.Default.MainForm_ExpressionHistory.Add(expression.ToString()); } Settings.Default.Save(); }