private void SetResult() { if (Parent1 != null && Parent2 != null) { var dna = DNATables.GetChild(Parent1.Source.NameEng, Parent2.Source.NameEng); if (dna != null) { _result = AllDigimons.FirstOrDefault(x => x.Source.NameEng == dna.DigimonChildId); } } // if (Parent1 != null && Parent2 != null && AllOptions.Any()) // { // var temp = AllOptions.FirstOrDefault(x => (Parent1 != Parent2 && x.Parents.Contains(Parent1) && x.Parents.Contains(Parent2)) // || (Parent1 == Parent2 && x.Parents.All(y => y == Parent1))); // if (temp != null) // _result = temp.Result; // else // _result = null; // } // else // { // _result = null; // } }
private void DoDigimonDetails(DigimonVM obj) { DigimonClicked?.Invoke(obj); }
public void DigimonClicked(DigimonVM obj) { SelectedItem = obj; IsSelected = true; }
private void DoNavigateTo(DigimonVM obj) { NameFilter = string.Empty; SelectedItem = obj; }
public static DigimonVM GetVM(this Digimon digimon) { var vm = new DigimonVM(); vm.DigivolveFrom = new ObservableCollection<DigivolveDigimonVM>(); vm.DigivolveTo = new ObservableCollection<DigivolveDigimonVM>(); vm.Skills = new ObservableCollection<SkillVM>(); vm.Source = digimon; //Локализуем поля switch (App.Language.Name) { case "ru-RU": vm.Name = digimon.NameRus; vm.Rank = ClassHelper.RankRus[digimon.Rank]; vm.Type = ClassHelper.TypeRus[digimon.Type]; vm.Speciality = ClassHelper.SpecialityRus[digimon.Speciality]; break; default: vm.Name = digimon.NameEng; vm.Rank = ClassHelper.RankEng[digimon.Rank]; vm.Type = ClassHelper.TypeEng[digimon.Type]; vm.Speciality = ClassHelper.SpecialityEng[digimon.Speciality]; break; } //Переливаем скиллы foreach (var skill in digimon.Skills) { var skillVm = new SkillVM(); skillVm.Source = skill; switch (App.Language.Name) { case "ru-RU": skillVm.Name = skill.NameRus; skillVm.Description = skill.SkillSource != SkillSource.Native ? $"{skill.DescriptionRus} ({ClassHelper.SkillSourceRus[skill.SkillSource]})" : skill.DescriptionRus; skillVm.Type = ClassHelper.SkillTypeRus[skill.Type]; break; default: skillVm.Name = skill.NameEng; skillVm.Description = skill.SkillSource != SkillSource.Native ? $"{skill.DescriptionEng} ({ClassHelper.SkillSourceEng[skill.SkillSource]})" : skill.DescriptionEng; skillVm.Type = ClassHelper.SkillTypeEng[skill.Type]; break; } vm.Skills.Add(skillVm); } //Переливаем локации в одну строку var locations = new List<string>(); foreach (var location in digimon.Locations) { switch (App.Language.Name) { case "ru-RU": locations.Add(location.Domain != null ? location.Domain.NameRus + " Эт.:" + string.Join(",", location.Floors) : location.DescriptionRus); break; default: locations.Add(location.Domain != null ? location.Domain.NameEng + " Lvl:" + string.Join(",", location.Floors) : location.DescriptionEng); break; } } vm.LocationStr = string.Join(" || ", locations); return vm; }
public static void SetSelectingItem(DependencyObject target, DigimonVM value) { target.SetValue(SelectingItemProperty, value); }