Esempio n. 1
0
        private void CreateStore()
        {
            string template         = @"Text\Store.js.t4";
            string templateBasePath = GetTemplateBasePath();

            if (!Path.IsPathRooted(template))
            {
                template = Path.Combine(templateBasePath, template);
            }
            template = new FileInfo(template).FullName;
            if (!template.StartsWith(templateBasePath))
            {
                throw new ArgumentException("Template Not found");
            }
            string templateCode = File.ReadAllText(template);

            var addProjectItemAction = new AddProjectItemAction();

            addProjectItemAction.Content        = Render(templateCode, template).ToString();
            addProjectItemAction.IsValid        = true;
            addProjectItemAction.TargetFileName = ModelClassName + "s.js";
            addProjectItemAction.Project        = CurrentProject;
            addProjectItemAction.Execute(DteHelper.FindInCollection(CurrentProject.ProjectItems, TemplateConfiguration.GetConfiguration().ExtRootFolderName + "\\Store"));
        }
        private void CreateStore()
        {
            string template = @"Text\Store.js.t4";
            string templateBasePath = GetTemplateBasePath();
            if (!Path.IsPathRooted(template))
            {
                template = Path.Combine(templateBasePath, template);
            }
            template = new FileInfo(template).FullName;
            if (!template.StartsWith(templateBasePath))
            {
                throw new ArgumentException("Template Not found");
            }
            string templateCode = File.ReadAllText(template);

            var addProjectItemAction = new AddProjectItemAction();
            addProjectItemAction.Content = Render(templateCode, template).ToString();
            addProjectItemAction.IsValid = true;
            addProjectItemAction.TargetFileName = ModelClassName + "s.js";
            addProjectItemAction.Project = CurrentProject;
            addProjectItemAction.Execute(DteHelper.FindInCollection(CurrentProject.ProjectItems, TemplateConfiguration.GetConfiguration().ExtRootFolderName + "\\Store"));
        }