Ejemplo n.º 1
0
        private void RemoveSpecies(SpeciesViewModel vm)
        {
            var answer = MessageBox.Show($"Are you sure you want to remove {vm.Species.Binomial} from the assessment?",
                                         "Remove Species?",
                                         MessageBoxButton.YesNo);

            if (answer != MessageBoxResult.Yes)
            {
                return;
            }
            Indicator.IncludedSpecies.Remove(vm.Species);
            RaisePropertyChanged(nameof(IncludedSpecies));
        }
        private void AddSpecies()
        {
            var species = new Species
            {
                Custom            = true,
                UserCanChangeCode = true,
                Code = RedListCode.NONE
            };
            var vm     = new SpeciesViewModel(species, null, RemoveSpecies);
            var window = new AddSpeciesWindow {
                DataContext = vm, Owner = Application.Current?.MainWindow
            };

            if (window.ShowDialog() != true)
            {
                return;
            }
            Indicator.IncludedSpecies.Add(species);
            RaisePropertyChanged(nameof(IncludedSpecies));
        }