private bool ShowPopupCloseDocuments(Project dirtyProject, List<Dialogue> dirtyDialogues) { if (dirtyProject != null || dirtyDialogues.Count > 0) { DialogSaveOnClose dialog = new DialogSaveOnClose(dirtyProject, dirtyDialogues); DialogResult result = dialog.ShowDialog(); if (result == DialogResult.Cancel) { return false; } else if (result == DialogResult.OK) { if (dirtyProject != null) ResourcesHandler.SaveProject(); foreach (Dialogue dialogue in dirtyDialogues) { ResourcesHandler.SaveDialogue(dialogue); } } else //DialogResult.Ignore > Close without saving { if (dirtyProject != null) ResourcesHandler.ReloadProject(); foreach (Dialogue dialogue in dirtyDialogues) { ResourcesHandler.ReloadDialogue(dialogue); } } } return true; }
private void OnSaveFile(object sender, EventArgs e) { if (dockPanel.ActiveDocument is DocumentProject) { ResourcesHandler.SaveProject(); documentProject.RefreshTitle(); } else if (dockPanel.ActiveDocument is DocumentDialogue) { var document = dockPanel.ActiveDocument as DocumentDialogue; document.ResolvePendingDirty(); ResourcesHandler.SaveDialogue(document.Dialogue); document.OnPostSave(); document.RefreshTitle(); } }
private void OnSaveAllFiles(object sender, EventArgs e) { if (documentProject != null) { if (ResourcesHandler.Project.Dirty) { ResourcesHandler.SaveProject(); documentProject.RefreshTitle(); } } foreach (DocumentDialogue document in documentDialogues) { var documentDialogue = document as DocumentDialogue; documentDialogue.ResolvePendingDirty(); if (ResourcesHandler.IsDirty(documentDialogue.Dialogue)) { ResourcesHandler.SaveDialogue(documentDialogue.Dialogue); documentDialogue.OnPostSave(); documentDialogue.RefreshTitle(); } } }