private void SetCurrentSelectedRule(TreeViewItemsViewModel treeViewItem) { CurrentSelectedRule = treeViewItem.RuleResult; treeViewItem.IsBorderVisible = true; var originalSelectedTreeViewItem = _currentedTreeviewItem; _currentedTreeviewItem = treeViewItem; if (originalSelectedTreeViewItem == null) { return; } originalSelectedTreeViewItem.IsBorderVisible = false; }
public static List <TreeViewItemsViewModel> GetTreeViewItems(Report report) { List <TreeViewItemsViewModel> items = new List <TreeViewItemsViewModel>(); List <string> parentList = new List <string>(); foreach (var rule in report.RuleList) { var ruleResult = rule.Value; var ruleNumber = rule.Key; var parent = ruleNumber.Remove(ruleNumber.Length - 2); var ruleClass = ruleResult.Content.Class; if (ruleResult.FinalResult == Result.DontTest) { ruleResult.Reset(); } if (!Report.ClassFilter(report.Class, ruleClass)) { ruleResult.DontTest(); continue; } TreeViewItemsViewModel parentItem = new TreeViewItemsViewModel { Title = parent, Level = 0, RuleResult = null, Items = new ObservableCollection <TreeViewItemsViewModel>() }; TreeViewItemsViewModel childItem = new TreeViewItemsViewModel { Title = ruleNumber, Level = 1, RuleResult = ruleResult }; if (!parentList.Contains(parent)) { parentItem.Items.Add(childItem); items.Add(parentItem); parentList.Add(parent); } else { items.Last().Items.Add(childItem); } } return(items); }