void C_ItemsParts_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (C_ItemsParts.SelectedIndex != -1) { UC_View_ItemImage itemShowed = C_Items.Items.FirstOrDefault(p => (p as UC_View_ItemImage).ImageIndex == (C_ItemsParts.SelectedItem as UC_View_ItemImage).ImageIndex) as UC_View_ItemImage; if (itemShowed != null) { C_Items.SelectedItem = itemShowed; } else { itemShowed = C_ItemsNormal.Items.FirstOrDefault(p => (p as UC_View_ItemImage).ImageIndex == (C_ItemsParts.SelectedItem as UC_View_ItemImage).ImageIndex) as UC_View_ItemImage; if (itemShowed != null) { C_ItemsNormal.SelectedItem = itemShowed; } else { itemShowed = C_ItemsStrong.Items.FirstOrDefault(p => (p as UC_View_ItemImage).ImageIndex == (C_ItemsParts.SelectedItem as UC_View_ItemImage).ImageIndex) as UC_View_ItemImage; if (itemShowed != null) { C_ItemsStrong.SelectedItem = itemShowed; } else { } } } } C_ItemsParts.SelectionChanged -= C_ItemsParts_SelectionChanged; C_ItemsParts.SelectedIndex = -1; C_ItemsParts.SelectionChanged += C_ItemsParts_SelectionChanged; }
private void ShowItemDetail(UC_View_ItemImage itemView) { UC_View_ItemImage.ShowImage(itemView.ImageIndex); foreach (var item in C_ItemStats.Children) { (item as FrameworkElement).Visibility = Windows.UI.Xaml.Visibility.Collapsed; } ItemClass itemShowed = _itemsEasy.FirstOrDefault(p => p.View == itemView); if (itemShowed == null) { itemShowed = _itemsNormal.FirstOrDefault(p => p.View == itemView); } if (itemShowed == null) { itemShowed = _itemsStrong.FirstOrDefault(p => p.View == itemView); } C_Price.Text = itemShowed.Price.ToString(); C_Name.Text = itemShowed.Name; C_DescriptionInfo.Text = itemShowed.Info.ShortDescription; if (!string.IsNullOrEmpty(itemShowed.Info.BuffDescription)) { C_BuffInfo.Text = itemShowed.Info.BuffDescription; } else { C_BuffInfo.Text = ""; } if (itemShowed.Demage != 0) { C_DemageView.Visibility = Windows.UI.Xaml.Visibility.Visible; C_Demage.Text = itemShowed.Demage.ToString(); } if (itemShowed.AttackSpeed != 0) { C_AttackSpeedView.Visibility = Windows.UI.Xaml.Visibility.Visible; C_AttackSpeed.Text = (itemShowed.AttackSpeed * 100).ToString(); } if (itemShowed.Speed != 0) { C_SpeedView.Visibility = Windows.UI.Xaml.Visibility.Visible; C_Speed.Text = (itemShowed.Speed * 100).ToString(); } if (itemShowed.ManaRegen != 0) { C_ManaRegenerationView.Visibility = Windows.UI.Xaml.Visibility.Visible; C_ManaRegeneration.Text = itemShowed.ManaRegen.ToString(); } if (itemShowed.HealthRegen != 0) { C_HealthRegenerationView.Visibility = Windows.UI.Xaml.Visibility.Visible; C_HealthRegeneration.Text = itemShowed.HealthRegen.ToString(); } if (itemShowed.ManaBonus != 0) { C_ManaBonusView.Visibility = Windows.UI.Xaml.Visibility.Visible; C_ManaBonus.Text = itemShowed.ManaBonus.ToString(); } if (itemShowed.HealthBonus != 0) { C_HealthBonusView.Visibility = Windows.UI.Xaml.Visibility.Visible; C_HealthBonus.Text = itemShowed.HealthBonus.ToString(); } if (itemShowed.HealthBonus != 0) { C_HealthBonusView.Visibility = Windows.UI.Xaml.Visibility.Visible; C_HealthBonus.Text = itemShowed.HealthBonus.ToString(); } if (itemShowed.Strength != 0) { C_StrengthView.Visibility = Windows.UI.Xaml.Visibility.Visible; C_Strength.Text = itemShowed.Strength.ToString(); } if (itemShowed.Agility != 0) { C_AgilityView.Visibility = Windows.UI.Xaml.Visibility.Visible; C_Agility.Text = itemShowed.Agility.ToString(); } if (itemShowed.Intelligence != 0) { C_IntelligenceView.Visibility = Windows.UI.Xaml.Visibility.Visible; C_Intelligence.Text = itemShowed.Intelligence.ToString(); } if (itemShowed.Armor != 0) { C_ArmorView.Visibility = Windows.UI.Xaml.Visibility.Visible; C_Armor.Text = itemShowed.Armor.ToString(); } if (itemShowed.Parts != null) { C_ItemsParts.Visibility = Windows.UI.Xaml.Visibility.Visible; List <FrameworkElement> partsView = new List <FrameworkElement>(); foreach (var item in itemShowed.Parts) { item.View.Width = 40; item.View.Height = 40; (item.View as UC_View_ItemImage).ShowPrice(item.Price); partsView.Add(item.View); } C_ItemsParts.ItemsSource = partsView; } else { C_ItemsParts.Visibility = Windows.UI.Xaml.Visibility.Collapsed; } }