Esempio n. 1
0
        public VariableTreeViewModel(VariableTree.VariableTree dataTree)
        {
            _rootNode = new VariableTreeNodeViewModel(dataTree.rootNode);

            _firstGeneration = new ReadOnlyCollection <VariableTreeNodeViewModel>(
                new VariableTreeNodeViewModel[]
            {
                _rootNode
            });

            _rootNode.IsExpanded = true;

            _searchCommand = new SearchFamilyTreeCommand(this);
        }
        public VariableTreeControl()
        {
            InitializeComponent();

            // Get raw family tree data from a database.
            VariableTree.VariableTree dataTree = presenter.sim.dataTree;
            this.DataContext = presenter;
            if (dataTree == null)
            {
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                presenter.sim.startDataTree();
                stopwatch.Stop();
                TimeSpan ts = stopwatch.Elapsed;

                dataTree = presenter.sim.dataTree;
            }

            // Create UI-friendly wrappers around the
            // raw data objects (i.e. the view-model).
            presenter.variableTree = new VariableTreeViewModel(dataTree);
        }