Пример #1
0
        private bool _canChangeVMToHighlight(object param)
        {
            GeneticTree        tree = param as GeneticTree;
            HighlightViewModel vm   = currentViewModel as HighlightViewModel;

            return(vm == null && tree != null);
        }
Пример #2
0
        private void _changeVMToHighlight(object param)
        {
            GeneticTree tree = param as GeneticTree;

            if (tree != null)
            {
                highlightVM      = new HighlightViewModel(tree);
                currentViewModel = highlightVM;
                OnPropertyChanged("currentViewModel");
            }
        }
Пример #3
0
        public DefaultViewModel()
        {
            gpData = new GeneticManagement();

            entryVM      = new EntryViewModel();
            populationVM = new PopulationViewModel();
            highlightVM  = new HighlightViewModel();
            fitnessVM    = new FitnessViewModel();
            selectionVM  = new SelectionCrossoverViewModel();

            initPopulationCommand = new RelayCommand(x => this._newPopulation(), x => this._canChangeVMToPopulation());
            populationCommand     = new RelayCommand(x => _changeVMToPopulation(x), x => _canChangeVMToPopulation());
            mainMenuCommand       = new RelayCommand(x => this._changeVMToEntry(), x => this._canChangeVMToEntry());
            highlightCommand      = new RelayCommand(x => this._changeVMToHighlight(x), x => this._canChangeVMToHighlight(x));
            fitnessCommand        = new RelayCommand(x => _changeVMToFitness(), x => _canChangeVMToFitness());
            selectionCommand      = new RelayCommand(x => _changeVMToSelection(), x => _canChangeVMToSelection());
            newGenCommand         = new RelayCommand(x => _changeVMToPopulationUpdate(), x => true);

            currentViewModel = entryVM;
            OnPropertyChanged("currentViewModel");
        }