private void LoadIncludedSpeciesModel() { var incSpecies = Service.GetGenusAvailableNameIncludedSpecies(Taxon.TaxaID.Value); _includedSpecies = new ObservableCollection<GANIncludedSpeciesViewModel>(incSpecies.ConvertAll((d) => { var vm = new GANIncludedSpeciesViewModel(d); vm.DataChanged += new DataChangedHandler((changedvm) => { if (d.GANISID < 0) { // don'note need to do anything, because the pending insert will use the most recent changes } else { RegisterUniquePendingChange(new UpdateGANIncludedSpeciesCommand(d)); } }); return vm; })); lstIncludedSpecies.ItemsSource = _includedSpecies; }
private void AddIncludedSpecies() { GANIncludedSpecies data = new GANIncludedSpecies(); data.GANISID = -1; data.BiotaID = this.Taxon.TaxaID.Value; data.IncludedSpecies = "<Included Species>"; var vm = new GANIncludedSpeciesViewModel(data); _includedSpecies.Add(vm); RegisterPendingChange(new InsertGANIncludedSpeciesCommand(data)); }