private void GoalViewInit() { TreeGoals.Clear(); GoalInfo = string.Empty; LineSel = new eLINE(); HostName = string.Empty; Label = string.Empty; }
private void OnEventViewGoalList(object sender, GOALINFO e) { GoalViewInit(); foreach (eGOALTYPE item in Enum.GetValues(typeof(eGOALTYPE))) { ObservableCollection <TreeData> SubChild1 = new ObservableCollection <TreeData>(); var lst = e.GetList(item); foreach (eLINE line in Enum.GetValues(typeof(eLINE))) { if (eLINE.None == line) { continue; } ObservableCollection <TreeData> SubChild2 = new ObservableCollection <TreeData>(); var linegoal = lst.Where(l => l.line == line).ToList(); foreach (var goal in linegoal) { SubChild2.Add(new TreeData() { Name = goal.label, Parent = item.ToString() }); } SubChild1.Add(new TreeData() { Name = $"Line #{line.ToString().Replace("_", "")}", Children = SubChild2 }); } TreeData treeData = new TreeData() { Name = item.ToString(), Children = SubChild1 }; TreeGoals.Add(treeData); } }