public CustomNodeSearchElementViewModel(CustomNodeSearchElementViewModel copyElement) : base(copyElement) { Path = copyElement.Path; }
public void NodeTypeToColorConverterTest() { var converter = new NodeTypeToColorConverter(); var trueBrush = new SolidColorBrush(Colors.Green); var falseBrush = new SolidColorBrush(Colors.Red); converter.FalseBrush = falseBrush; converter.TrueBrush = trueBrush; object result; //1. Element is null. //2. Element is CustomNodeSearchElement. // 1 case result = converter.Convert(null, null, null, null); Assert.AreEqual(falseBrush, result); // 2 case var CneVM = new CustomNodeSearchElementViewModel( new CustomNodeSearchElement(null, new CustomNodeInfo(Guid.NewGuid(), "", "", "", "")), null); result = converter.Convert(CneVM, null, null, null); Assert.AreEqual(trueBrush, result); }
private void PopulateSearchCategories(IEnumerable<NodeSearchElement> nodes) { foreach (NodeSearchElement node in nodes) { var rootCategoryName = NodeSearchElement.SplitCategoryName(node.FullCategoryName).FirstOrDefault(); var category = searchRootCategories.FirstOrDefault(sc => sc.Name == rootCategoryName); if (category == null) { category = new SearchCategory(rootCategoryName); searchRootCategories.Add(category); } var elementVM = MakeNodeSearchElementVM(node); elementVM.Category = GetCategoryViewModel(libraryRoot, node.Categories); category.AddMemberToGroup(elementVM); } if (nodes.Count() == 0) { selectionNavigator.UpdateRootCategories(SearchRootCategories); return; } // Clone top node. NodeSearchElementViewModel topNode; var firstNode = MakeNodeSearchElementVM(nodes.First()); if (firstNode is CustomNodeSearchElementViewModel) { topNode = new CustomNodeSearchElementViewModel(firstNode as CustomNodeSearchElementViewModel); } else { topNode = new NodeSearchElementViewModel(firstNode); } topNode.IsTopResult = true; SortSearchCategoriesChildren(); var topCategory = new SearchCategory(Dynamo.Wpf.Properties.Resources.SearchViewTopResult, true); topCategory.AddMemberToGroup(topNode); searchRootCategories.Insert(0, topCategory); selectionNavigator.UpdateRootCategories(SearchRootCategories); }