Beispiel #1
0
        public void LoadProjectTest()
        {
            var project = DocProject.LoadProject(projectFile);

            project.GetTopicTree(project.Topics);
            WriteChildTopics(project.Topics, 0);
        }
Beispiel #2
0
        /// <summary>
        /// Loads or reloads a project by filename
        /// </summary>
        /// <param name="activeProjectFilename"></param>
        public void LoadProject(string activeProjectFilename)
        {
            var proj = DocProject.LoadProject(activeProjectFilename);

            TopicsTree.LoadProject(proj);
            ActiveProject = proj;
        }
Beispiel #3
0
        public void LoadAndSaveProjectTest()
        {
            var project = DocProject.LoadProject(projectFile);

            project.GetTopicTree(project.Topics);
            WriteChildTopics(project.Topics, 0);

            project.Filename = projectFile;
            project.SaveProject();
        }
Beispiel #4
0
        public void LoadTopicTest()
        {
            var project = DocProject.LoadProject(@"c:\temp\wconnect_help\wconnect_help.json");

            var topic = project.LoadByTitle("West Wind Web Connection");

            Assert.True(topic != null, project.ErrorMessage);

            Console.WriteLine(topic.Body);
            Assert.NotNull(topic.Body);
            Assert.IsTrue(topic.Body.Contains("Welcome to West Wind Web Connection"));
        }
Beispiel #5
0
        public void OpenProject(string projectFile, bool noErrorDisplay = false)
        {
            Window.ShowStatus("Opening project file...");
            ActiveProject = null;

            DocProject project = null;

            if (string.IsNullOrEmpty(projectFile))
            {
                /// TODO: Need Wizard here
                project = DocProjectManager.CreateProject(new DocProjectCreator()
                {
                    Filename      = System.IO.Path.GetFileName(projectFile),
                    ProjectFolder = System.IO.Path.GetDirectoryName(projectFile),
                    Title         = "New Project",
                    Owner         = "West Wind Technologies"
                });
            }
            else
            {
                project = DocProject.LoadProject(projectFile);
                if (project == null)
                {
                    if (!noErrorDisplay)
                    {
                        MessageBox.Show("Failed to load project.",
                                        KavaApp.ApplicationName,
                                        MessageBoxButton.OK,
                                        MessageBoxImage.Warning);
                    }
                    else
                    {
                        Window.ShowStatus("Failed to load project: " + projectFile,
                                          KavaApp.Configuration.StatusMessageTimeout);
                        Window.SetStatusIcon(FontAwesomeIcon.Warning, Colors.Red);
                    }

                    Window.ShowStatus();
                    return;
                }
            }

            Window.ShowStatus("Generating project tree...");

            ActiveProject = project;
            TopicsTree.LoadProject(project);

            PreviewTopic();

            Window.ShowStatus($"Project '{project.Title}' opened.", KavaApp.Configuration.StatusMessageTimeout);
        }
Beispiel #6
0
        public void LoadTopicAndSaveTest()
        {
            var project = DocProject.LoadProject(@"c:\temp\wconnect_help\wconnect_help.json");

            var topic = project.LoadTopic("INDEX");

            Assert.True(topic != null, project.ErrorMessage);

            Console.WriteLine(topic.Body);
            Assert.NotNull(topic.Body);
            Assert.IsTrue(topic.Body.Contains("Welcome to West Wind Web Connection"));

            topic.Title = "West Wind Web Connection " + DataUtils.GenerateUniqueId(5);
            topic.Body  = "Updated " + DataUtils.GenerateUniqueId(5) + " " + topic.Body;

            Assert.True(project.SaveTopic(topic), project.ErrorMessage);

            Assert.True(project.SaveProject());
        }