Category CreateCategory(TemplateCategory templateCategory) { Category item = new Category(templateCategory.DisplayName); foreach (var subcategory in Sorted(templateCategory.Subcategories)) { var subItem = CreateCategory(subcategory); if (!subItem.IsEmpty) { item.Items.Add(subItem); } } foreach (var template in templateCategory.Templates.OfType <ProjectTemplate>()) { if (!template.IsVisible(SolutionFolder != null ? SolutionFolder.ParentSolution : null)) { // Do not show solution template when added a new project to existing solution continue; } TemplateItem templateItem = new TemplateItem(template); AllTemplates.Add(templateItem); item.Templates.Add(templateItem); } return(item); }
private void handleTemplateChanges(TemplateFormData data) { for (var i = 0; i < AllTemplates.Count; i++) { if (AllTemplates[i].TemplateName == data.TemplateName) { AllTemplates[i] = data; return; } } AllTemplates.Add(data); }
private void CreateNewTemplate(object param) { string templateName = (string)param; if (string.IsNullOrWhiteSpace(templateName)) { return; } foreach (var template in AllTemplates) { if (template.TemplateName == templateName) { return; } } TemplateViewModel newTemplate = new TemplateViewModel((string)templateName, AllTypes[0]); AllTemplates.Add(newTemplate); SelectedTemplate = newTemplate; }