예제 #1
0
        /// <inheritdoc/>
        ProjectContainer IProjectFactory.GetProject()
        {
            var factory = this as IProjectFactory;
            var project = ProjectContainer.Create();

            // Group Libraries
            var glBuilder = project.GroupLibraries.ToBuilder();

            glBuilder.Add(Library <GroupShape> .Create("Default"));
            project.GroupLibraries = glBuilder.ToImmutable();

            project.SetCurrentGroupLibrary(project.GroupLibraries.FirstOrDefault());

            // Style Libraries
            var sgBuilder = project.StyleLibraries.ToBuilder();

            sgBuilder.Add(DefaultStyleLibrary());
            sgBuilder.Add(LinesStyleLibrary());
            sgBuilder.Add(TemplateStyleLibrary());
            project.StyleLibraries = sgBuilder.ToImmutable();

            project.SetCurrentStyleLibrary(project.StyleLibraries.FirstOrDefault());

            // Templates
            var templateBuilder = project.Templates.ToBuilder();

            templateBuilder.Add(factory.GetTemplate(project, "Empty"));
            templateBuilder.Add(CreateGridTemplate(this, project, "Grid"));
            project.Templates = templateBuilder.ToImmutable();

            project.SetCurrentTemplate(project.Templates.FirstOrDefault(t => t.Name == "Grid"));

            // Documents and Pages
            var document = factory.GetDocument(project, "Document");
            var page     = factory.GetPage(project, "Page");

            var pageBuilder = document.Pages.ToBuilder();

            pageBuilder.Add(page);
            document.Pages = pageBuilder.ToImmutable();

            var documentBuilder = project.Documents.ToBuilder();

            documentBuilder.Add(document);
            project.Documents = documentBuilder.ToImmutable();

            project.Selected = document.Pages.FirstOrDefault();

            // Databases
            var db             = Database.Create("Db");
            var columnsBuilder = db.Columns.ToBuilder();

            columnsBuilder.Add(Column.Create(db, "Column0"));
            columnsBuilder.Add(Column.Create(db, "Column1"));
            db.Columns        = columnsBuilder.ToImmutable();
            project.Databases = project.Databases.Add(db);

            project.SetCurrentDatabase(db);

            return(project);
        }