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 OnReloadFile(object sender, EventArgs e) { if (ResourcesHandler.Project == null) { return; } if (dockPanel.ActiveDocument is DocumentProject && ResourcesHandler.Project.Dirty) { var dialog = new DialogConfirmReload(ResourcesHandler.Project, new List <Dialogue>()); DialogResult result = dialog.ShowDialog(); if (result == DialogResult.OK) { ResourcesHandler.ReloadProject(); documentProject.OnPostReload(); EditorCore.LogInfo("Reloaded project file"); } } else if (dockPanel.ActiveDocument is DocumentDialogue) { var document = dockPanel.ActiveDocument as DocumentDialogue; document.ResolvePendingDirty(); bool proceed = true; if (ResourcesHandler.IsDirty(document.Dialogue)) { var dialog = new DialogConfirmReload(null, new List <Dialogue>() { document.Dialogue }); DialogResult result = dialog.ShowDialog(); proceed = (result == DialogResult.OK); } if (proceed) { ResourcesHandler.ReloadDialogue(document.Dialogue); document.OnPostReload(); EditorCore.LogInfo("Reloaded current dialogue file"); } } }