예제 #1
0
        public DepartmentViewModel(Department department, DepartmentViewModel parent)
        {
            _department = department;
            _parent = parent;

            _children = new ObservableCollection<DepartmentViewModel>(
                    (from child in _department.Children
                     select new DepartmentViewModel(child, this))
                     .ToList<DepartmentViewModel>());
        }
예제 #2
0
        public DepartmentTreeViewModel(Department rootDepartment)
        {
            _rootDepartment = new DepartmentViewModel(rootDepartment);

            _firstGeneration = new ObservableCollection<DepartmentViewModel>(
                new DepartmentViewModel[] 
                { 
                    _rootDepartment
                });

            //_firstGeneration.CollectionChanged += _firstGeneration_CollectionChanged;

            _searchCommand = new SearchFamilyTreeCommand(this);
        }
예제 #3
0
        IEnumerable<DepartmentViewModel> FindMatches(string searchText, DepartmentViewModel person)
        {
            if (person.NameContainsText(searchText))
                yield return person;

            foreach (DepartmentViewModel child in person.Children)
                foreach (DepartmentViewModel match in this.FindMatches(searchText, child))
                    yield return match;
        }