public UpdateTraitDatabaseCommand(Trait trait, ViewModelBase owner) : base(trait, owner) { }
private void AddNewTrait() { var service = new SupportService(User); List<String> traitTypes = service.GetTraitNamesForCategory(TraitCategory.ToString()); var picklist = new PickListWindow(User, "Choose a trait type...", () => { return traitTypes; }, (text) => { traitTypes.Add(text); return true; }); picklist.Owner = this.FindParentWindow(); if (picklist.ShowDialog().ValueOrFalse()) { var existing = FindTraitByName(picklist.SelectedValue as string); if (existing == null) { Trait t = new Trait(); t.TraitID = -1; t.Value = "<New Trait Value>"; t.Category = TraitCategory.ToString(); t.IntraCatID = Owner.ObjectID.Value; t.Name = picklist.SelectedValue as string; TraitViewModel viewModel = new TraitViewModel(t); _model.Add(viewModel); RegisterUniquePendingChange(new UpdateTraitDatabaseCommand(t, Owner)); ReloadTraitPanel(); SelectTrait(viewModel); } else { SelectTrait(existing); } } }
public TraitDatabaseCommandBase(Trait trait, ViewModelBase owner) { this.Trait = trait; this.Owner = owner; }