Пример #1
0
        private void OnReloadAllFiles(object sender, EventArgs e)
        {
            if (ResourcesHandler.Project == null)
            {
                return;
            }

            Project project   = null;
            var     dialogues = new List <Dialogue>();

            if (documentProject != null && ResourcesHandler.Project.Dirty)
            {
                project = ResourcesHandler.Project;
            }

            if (documentDialogues.Count > 0)
            {
                foreach (DocumentDialogue document in documentDialogues)
                {
                    var documentDialogue = document as DocumentDialogue;
                    documentDialogue.ResolvePendingDirty();
                    if (ResourcesHandler.IsDirty(documentDialogue.Dialogue))
                    {
                        dialogues.Add(documentDialogue.Dialogue);
                    }
                }
            }

            bool reloadOK = true;

            if (project != null || dialogues.Count > 0)
            {
                var          dialog = new DialogConfirmReload(project, dialogues);
                DialogResult result = dialog.ShowDialog();
                reloadOK = (result == DialogResult.OK);
            }

            if (reloadOK)
            {
                ResourcesHandler.ReloadAll();

                if (documentProject != null)
                {
                    documentProject.OnPostReload();
                }

                foreach (DocumentDialogue document in documentDialogues)
                {
                    var documentDialogue = document as DocumentDialogue;
                    documentDialogue.OnPostReload();
                }

                EditorCore.LogInfo("Reloaded all project files");
            }
        }
Пример #2
0
        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");
                }
            }
        }