예제 #1
0
 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);
         }
     }
 }
예제 #2
0
        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);
                }
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }