Exemple #1
0
        private void OnReloadAllFiles(object sender, EventArgs e)
        {
            if (ResourcesHandler.Project == null)
            {
                return;
            }

            // Backup opened dialogues names.
            List <string> openedDialogues = new List <string>();

            foreach (DocumentDialogue document in documentDialogues)
            {
                openedDialogues.Add(document.Dialogue.GetName());
            }

            if (CloseAllDocuments())
            {
                EditorCore.Properties?.Clear();
                EditorCore.CustomProperties?.Clear();
                EditorCore.ProjectExplorer?.Clear();

                ResourcesHandler.ReloadAll();

                EditorCore.ProjectExplorer.ResyncAllFiles();

                // Re-open dialogues if possible.
                foreach (string name in openedDialogues)
                {
                    OpenDocumentDialogue(name);
                }

                EditorCore.LogInfo("Reloaded all project files");
            }
        }
Exemple #2
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");
            }
        }