/// <summary> /// Returns all nested categories from a sequence of search entries. /// </summary> /// <typeparam name="TEntry"></typeparam> /// <param name="category"></param> /// <returns></returns> internal static IEnumerable <string> GetAllCategoryNames <TEntry>(this ISearchCategory <TEntry> category) { yield return(category.Name); foreach (var name in category.SubCategories.SelectMany(GetAllCategoryNames)) { yield return(string.Format("{0}.{1}", category.Name, name)); } }
public SmartSearchCategory(ISearchCategory category) { this.InitializeComponent(); this.Category = category; this.headerText.Text = category.Header; this.Reset(); }
public bool AddCategory(ISearchCategory category) { foreach (SmartSearchCategory cat in this.resultsStack.Children) { if (cat.Category == category) return false; } this.resultsStack.Children.Add(new SmartSearchCategory(category)); return true; }
public bool RemoveCategory(ISearchCategory category) { for (int i = 0; i < this.resultsStack.Children.Count; i++) { if (((SmartSearchCategory)this.resultsStack.Children[i]).Category == category) { this.resultsStack.Children.RemoveAt(i); return true; } } return false; }
private static void AddCategoryToXml( XmlNode parent, ISearchCategory <NodeSearchElement> category) { var element = XmlHelper.AddNode(parent, "Category"); XmlHelper.AddAttribute(element, "Name", category.Name); foreach (var subCategory in category.SubCategories) { AddCategoryToXml(element, subCategory); } foreach (var entry in category.Entries) { AddEntryToXml(element, entry); } }