public void ParentSelected(object obj) { PR = obj as Race; if (PR != ParentRaceList[0]) { SelectedParentRace = PR; Speed = PR.Speed; Size = Utility.ParseEnum<Size>(PR.Size); Darkvision = PR.Darkvision; AssignAbilityBonus(PR); //MessageBox.Show(PR.AbiBonus); SelectedWeaponProficiencies = PR.WeaponProficiencies; WeaponProficiencyViewModel = new WeaponProficiencyViewModel(SelectedWeaponProficiencies); SelectedArmorProficiencies = PR.ArmorProficiencies; ArmorProficiencyViewModel = new ArmorProficiencyViewModel(SelectedArmorProficiencies); SelectedToolProficiencies = PR.ToolProficiencies; ToolProficiencyViewModel = new ToolProficiencyViewModel(SelectedToolProficiencies); SelectedSkillProficiencies = PR.SkillProficiencies; SkillProficiencyViewModel = new SkillProficiencyViewModel(SelectedSkillProficiencies); SelectedLanguageProficiencies = PR.Languages; LanguageProficiencyViewModel = new LanguageProficiencyViewModel(SelectedLanguageProficiencies); } else resetStuff(); }
//Constuctor public RaceCreationViewModel() { //Test Things AddAbilityBonusCommand = new TypeCommand<StackPanel>(AddAbility); TestCommand = new RelayCommand(Test, param =>canExecute); //Commands CreateRaceCommand = new RelayCommand(AddRaceToDB, param =>canExecute); AddArmorProficiencyCommand = new RelayCommand(AddArmorProficiencies, param=>canExecute); AddWeaponProficiencyCommand = new RelayCommand(AddWeaponProficiencies, param=>canExecute); AddToolProficiencyCommand = new RelayCommand(AddToolProficiencies, param=>canExecute); AddSkillProficiencyCommand = new RelayCommand(AddSkillProficiencies, param => canExecute); AddLanguagesProficiencyCommand = new RelayCommand(AddLanguageProficiencies, param => canExecute); ResetAllCommand = new RelayCommand(ResetAll); ParentSelectedCommand = new RelayCommand(ParentSelected, param => canExecute); ParentToggledCommand = new RelayCommand(ParentToggled, param => canExecute); //ViewModels WeaponProficiencyViewModel = new WeaponProficiencyViewModel(SelectedWeaponProficiencies); ArmorProficiencyViewModel = new ArmorProficiencyViewModel(SelectedArmorProficiencies); ToolProficiencyViewModel = new ToolProficiencyViewModel(SelectedToolProficiencies); SkillProficiencyViewModel = new SkillProficiencyViewModel(SelectedSkillProficiencies); LanguageProficiencyViewModel = new LanguageProficiencyViewModel(SelectedLanguageProficiencies); CurrentVM = WeaponProficiencyViewModel; PropertyChanged += SelectedParentRace_PropertyChanged; }