private void AddNode(SemanticTypeViewModel st) { foreach (SemanticType w in _words) { if (st.Id == w.ParentId) { SemanticTypeViewModel child = new SemanticTypeViewModel(w); st.Words.Add(child); AddNode(child); } } }
public void Bind() { Parents.Clear(); _words = Data.Access.GetSemanticTypes(); foreach (SemanticType type in _words) { SemanticTypeViewModel parent = new SemanticTypeViewModel(type); AddNode(parent); if (parent.ParentId == 0) { parent.IsExpanded = true; Parents.Add(parent); } } }
private SemanticTypeViewModel Deepen(SemanticTypeViewModel stvm) { SemanticTypeViewModel selected = null; foreach (SemanticTypeViewModel semanticTypeViewModel in stvm.Words) { if (semanticTypeViewModel.IsSelected) { return(semanticTypeViewModel); } selected = Deepen(semanticTypeViewModel); if (selected != null && selected.IsSelected) { return(selected); } } return(selected); }
private SemanticTypeViewModel GetSelectedType() { SemanticTypeViewModel selected = null; foreach (SemanticTypeViewModel semanticTypeViewModel in Parents) { if (semanticTypeViewModel.IsSelected) { return(semanticTypeViewModel); } selected = Deepen(semanticTypeViewModel); if (selected != null && selected.IsSelected) { break; } } return(selected); }