private void CSharpLibraryForm_FormClosing(object sender, FormClosingEventArgs e) { if (StatusLabel_FileName.Text.EndsWith("*")) { MemoryBox box = new MemoryBox(); MemoryBoxResult rt = box.ShowCloseMemoryDialog(StatusLabel_FileName.Text.TrimEnd('*'), true); if (rt == MemoryBoxResult.Yes) { Button_Save_Click(sender, e); } else if (rt == MemoryBoxResult.Cancel) { e.Cancel = true; return; } else if (rt == MemoryBoxResult.NoToAll) { return; } } }
private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { try { foreach (IDockableWindow doc in this.DockContainer.Documents) { if ((doc is EditorTabItem) == false) break; EditorTabItem item = doc as EditorTabItem; if (item.TabText.EndsWith("*") == false) break; MemoryBox box = new MemoryBox(); MemoryBoxResult rt = box.ShowCloseMemoryDialog(item.TabText.TrimEnd('*')); if (rt == MemoryBoxResult.Yes) { do { if (string.IsNullOrEmpty(item.FileName) == false && this.CurrentEditorTabItem.HaveFileName) { item.Save(null); item.TabText = item.TabText.TrimEnd('*'); SetAllFileNameLabel(item.FileName); break; } SaveFileDialog svd = new SaveFileDialog(); svd.Filter = item.FileExtension; if (svd.ShowDialog() == DialogResult.OK) { item.Save(svd.FileName); AddRecent(item.FileName); SetAllFileNameLabel(svd.FileName); item.TabText = item.TabText.TrimEnd('*'); } } while (false); continue; } if (rt == MemoryBoxResult.Cancel) { e.Cancel = true; break; } if (rt == MemoryBoxResult.NoToAll) break; } if (!e.Cancel) { this.SaveRecentFiles(); GUIUtility.SaveSettingValue(); } } catch (IOException) { } catch (Exception ex) { Utilities.LogException(ex, null); } }