/// <summary> /// Initializes a new instance of the <see cref="GraphContextMenuProvider" /> class. /// </summary> /// <param name="graph">The graph.</param> /// <param name="contextMenuControl">The context menu control.</param> public GraphContextMenuProvider(IGraph graph, IGraphContextMenuControl contextMenuControl) { FlatItems = new GraphMenuItemCollection((GraphMenuItem)null); _items = new GraphMenuItemCollection((GraphMenuItem)null); _flatItemsResult = new GraphMenuItemCollection((GraphMenuItem)null); _graph = graph; _contextMenuControl = contextMenuControl; }
private void SearchCore(string text) { if (string.IsNullOrWhiteSpace(text) || text?.Length < 2) { _isFiltered = false; //_items.ToList().ForEach(x => x.IsVisible = true); return; } _isFiltered = true; //foreach (var item in FlatItems) //{ // SearchItem(item, text); //} //var str = FlatItems.FirstOrDefault(x => x.DisplayName.Contains("string")); //var result = _flatItemsResult; //_flatItemsResult = new GraphMenuItemCollection(result.OrderBy(x => x.Name)); var result = FlatItems.Where(x => x.SearchableContent.Contains(text)); _flatItemsResult = new GraphMenuItemCollection(result.OrderBy(x => x.Name, new ClosestStringComparer(text, _flatItemsResult.Count()))); }
/// <summary> /// Initializes a new instance of the <see cref="GraphMenuItem"/> class. /// </summary> public GraphMenuItem() { _items = new GraphMenuItemCollection(this); }