private void OnClosing(object sender, CancelEventArgs e) { // Find the schematics that have pending edits. IEnumerable <SchematicEditor> save = EditorListDialog.Show( this, "Save the following schematics?", MessageBoxButton.YesNoCancel, Editors.Where(i => i.Edits.Dirty)); if (save != null) { foreach (SchematicEditor i in save) { if (!i.Save()) { e.Cancel = true; return; } } } else { e.Cancel = true; } }
private void OnActivated(object sender, EventArgs e) { if (activating) { return; } activating = true; // Find the schematics that have been modified outside the editor. IEnumerable <SchematicEditor> modified = EditorListDialog.Show( this, "The following schematics were modified outside LiveSPICE, do you want to reload them?", MessageBoxButton.YesNo, Editors.Where(i => i.CheckForModifications()).ToList()); if (modified != null) { foreach (SchematicEditor i in modified) { i.Touch(); } foreach (SchematicEditor i in modified) { Open(i.FilePath, true); } } activating = false; }