TemplateCategory AddTemplateCategory(string categoryName, TemplateCategory parent) { var templateCategory = new TemplateCategory(categoryName, categoryName, "iconid"); parent.AddCategory(templateCategory); return(templateCategory); }
public TemplateCategory Clone () { var clone = new TemplateCategory (Id, Name, IconId) { IsDefault = IsDefault, IsTopLevel = IsTopLevel, MappedCategories = MappedCategories }; foreach (TemplateCategory child in categories) { clone.AddCategory (child.Clone ()); } return clone; }
public TemplateCategory Clone() { var clone = new TemplateCategory(Id, Name, IconId) { IsDefault = IsDefault, IsTopLevel = IsTopLevel, MappedCategories = MappedCategories }; foreach (TemplateCategory child in categories) { clone.AddCategory(child.Clone()); } return(clone); }
TemplateCategory AddTemplateCategory (string categoryName, TemplateCategory parent) { var templateCategory = new TemplateCategory (categoryName, categoryName, "iconid"); parent.AddCategory (templateCategory); return templateCategory; }
void AddChildren (TemplateCategory category) { foreach (var childCodon in ChildNodes.OfType<TemplateCategoryCodon> ()) { category.AddCategory (childCodon.ToTemplateCategory ()); } }
void LoadTemplateCategories () { // Load all builtin project templates. var builtins = System.Reflection.Assembly.GetExecutingAssembly ().GetTypes () .Where (x => typeof (IProtobuildModuleTemplate).IsAssignableFrom (x)) .Where (x => x.GetCustomAttributes (typeof (BuiltinProtobuildModuleTemplateAttribute), false).Length > 0) .Select (Activator.CreateInstance) .OfType<IProtobuildModuleTemplate> (); var featuredCategory = new TemplateCategory("featured", "Featured", null); var generalCategory = new TemplateCategory("general", "General", null); var onlineCategory = new TemplateCategory("online", "Online", null); var miscCategory = new TemplateCategory("misc", "Miscellanous", null); var protobuildCategory = new TemplateCategory ("protobuild", "Protobuild", "md-platform-other"); protobuildCategory.AddCategory(featuredCategory); protobuildCategory.AddCategory(onlineCategory); protobuildCategory.AddCategory(generalCategory); protobuildCategory.AddCategory(miscCategory); var featuredGeneralCategory = new TemplateCategory("featured-general", "Featured", "md-platform-other"); featuredCategory.AddCategory(featuredGeneralCategory); var generalGeneralCategory = new TemplateCategory("general-general", "General", "md-platform-other"); generalCategory.AddCategory(generalGeneralCategory); string message; if (string.IsNullOrEmpty (LastSearch)) { message = "Use the search in the top right!"; } else { message = "No Results for '" + LastSearch + "'"; } var onlineResultsCategory = new TemplateCategory("online-general", "Results for '" + LastSearch + "'", "md-platform-other"); var onlineNoResultsCategory = new TemplateCategory("online-general", message, "md-platform-other"); var miscGeneralCategory = new TemplateCategory("misc-general", "Miscellanous", "md-platform-other"); miscCategory.AddCategory(miscGeneralCategory); var online = new List<ProtobuildSolutionTemplate> (); foreach (var builtin in builtins.Concat(OnlineProtobuildModuleTemplates)) { var project = new ProtobuildSolutionTemplate(builtin.Id, builtin.Name, builtin.IconId) { Description = builtin.Description, GroupId = builtin.GroupId, ImageId = builtin.ImageId }; if (builtin.IsFeatured) { featuredGeneralCategory.AddTemplate(project); } if (builtin.IsOnline) { onlineResultsCategory.AddTemplate(project); online.Add(project); } if (builtin.IsGeneral) { generalGeneralCategory.AddTemplate(project); } if (builtin.IsMisc) { miscGeneralCategory.AddTemplate(project); } } onlineCategory.AddCategory(online.Count == 0 ? onlineNoResultsCategory : onlineResultsCategory); var selected = online.FirstOrDefault(); if (selected != null) { this.SelectedTemplate = selected; } if (this.SelectedSecondLevelCategory != null) { this.SelectedSecondLevelCategory = onlineCategory; } templateCategories = new List<TemplateCategory>(); templateCategories.Add(protobuildCategory); }