예제 #1
0
        /// <summary>
        /// Shows the project.
        /// </summary>
        /// <param name="project">The project.</param>
        public void ShowProject(GenerateProject project)
        {
            _project = project;
            tvObjects.Nodes.Clear();

            AddProjectNode(project);
        }
예제 #2
0
        /// <summary>
        /// Adds the project node.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <returns></returns>
        private TreeNode AddProjectNode(GenerateProject project)
        {
            var       projectName = project.ProjectFileName;
            const int imageIndex  = (int)ObjImage.Project;

            var rootNode = tvObjects.Nodes.Add(projectName, projectName, imageIndex, imageIndex);

            rootNode.Tag = project;
            ShowGenerations(rootNode.Nodes);
            return(rootNode);
        }
예제 #3
0
        /// <summary>
        /// Loads the project.
        /// </summary>
        /// <param name="project">The project.</param>
        public void LoadProject(GenerateProject project)
        {
            this.project = project;

            //project.Validate();

            if (projectBrowser != null)
            {
                projectBrowser.ShowProject(project);
            }

            generator = new GeneratorType();
            generator.TemplateGenerated += TemplateGenerated;
            generator.InitalizeFromProject(project);

            if (browser != null && File.Exists(project.SchemaFileFullPath))
            {
                browser.OpenFile(project.SchemaFileFullPath);
            }
            OnProjectLoaded();
        }
예제 #4
0
        /// <summary>
        /// Initalizes from project.
        /// </summary>
        /// <param name="project">The project.</param>
        public void InitalizeFromProject(GenerateProject project)
        {
            outputPath   = project.OutputPath;
            solutionFile = project.SolutionFile;
            properties   = project.Properties;
            templatePath = project.TemplateFullPath;
            visualStudio = new VisualStudio(project.VisualStudioVersion, project.SolutionFile);

            if (String.IsNullOrEmpty(OutputPath))
            {
                throw new CodeGenerationException("Project OutputPath empty");
            }
            if (!Directory.Exists(OutputPath))
            {
                Directory.CreateDirectory(OutputPath);
            }

            if (OutputPath.Substring(OutputPath.Length - 1, 1) != "\\")
            {
                OutputPath = OutputPath + "\\";
            }


            foreach (Property projectProperty in Properties)
            {
                context.Put(projectProperty.Name, projectProperty.Value);
            }

            if (!Directory.Exists(templatePath))
            {
                throw new CodeGenerationException("Generate Project has not templates");
            }

            var extendedProperties = new ExtendedProperties();

            extendedProperties.AddProperty(SettNameTemplatePath, templatePath);
            Velocity.Init(extendedProperties);
        }
예제 #5
0
        /// <summary>
        /// Closes the project.
        /// </summary>
        public void CloseProject()
        {
            if (project == null)
            {
                return;
            }

            project = null;
            fileTabs.ClearTabs();
            projectBrowser.Clear();

            if (generator != null)
            {
                generator.TemplateGenerated -= TemplateGenerated;
                generator.Dispose();
                generator = null;
            }
            if (browser != null)
            {
                browser.Clear();
            }

            //OnProjectClosed();
        }
예제 #6
0
 /// <summary>
 /// Clears this instance.
 /// </summary>
 public void Clear()
 {
     _project = null;
     tvObjects.Nodes.Clear();
 }
예제 #7
0
 /// <summary>
 /// Loads the project.
 /// </summary>
 /// <param name="fileName">Name of the file.</param>
 public void LoadProject(string fileName)
 {
     LoadProject(GenerateProject.Load(fileName));
 }