private void equipmentPopupHelper(Image image, EquippedItem equipedItem, String slot)
        {
            if (equipedItem == null)
                return;

            Item detailedItem;
            itemDictionary.TryGetValue(equipedItem, out detailedItem);


            itemInfoName.Text = equipedItem.Name;
            SolidColorBrush solidColorBrush;
            /*switch (equipedItem.Quality)
            {

                case ItemQuality.Common:
                    solidColorBrush = new SolidColorBrush(Windows.UI.Colors.White);
                    break;
                case ItemQuality.Uncommon:
                    solidColorBrush = new SolidColorBrush(Windows.UI.Colors.Green);
                    break;
                case ItemQuality.Rare:
                    solidColorBrush = new SolidColorBrush(Windows.UI.Colors.Blue);
                    break;
                case ItemQuality.Epic:
                    solidColorBrush = new SolidColorBrush(Windows.UI.Colors.Purple);
                    break;
                case ItemQuality.Legendary:
                    solidColorBrush = new SolidColorBrush(Windows.UI.Colors.Orange);
                    break;
                case ItemQuality.Artifact:
                    solidColorBrush = new SolidColorBrush(Windows.UI.Colors.LightGoldenrodYellow);
                    break;
                case ItemQuality.Heirloom:
                    solidColorBrush = new SolidColorBrush(Windows.UI.Colors.LightGoldenrodYellow);
                    break;
                default:
                    solidColorBrush = new SolidColorBrush(Windows.UI.Colors.White);
                    break;
            }
            itemInfoName.Foreground = solidColorBrush;*/
            itemInfoItemLevel.Text = "Item Level " + equipedItem.ItemLevel;
            try
            {
                itemInfoUpgradeLevel.Text = "Upgrade Level: " + equipedItem.TooltipParams.Upgrade.Current + "/" + equipedItem.TooltipParams.Upgrade.Total;
                itemInfoUpgradeLevel.Visibility = Visibility.Visible;
            }
            catch (NullReferenceException)
            {
                itemInfoUpgradeLevel.Visibility = Visibility.Collapsed;
            }

            if (detailedItem != null)
            {
                String bindType = null;
                /*switch (detailedItem.BindType)
                {
                    case ItemBindType.BindOnEquipped:
                        bindType = "Binds on Equip";
                        break;
                    case ItemBindType.BindOnPickup:
                        bindType = "Binds on Pickup";
                        break;
                    case ItemBindType.BindOnUse:
                        bindType = "Binds on Use";
                        break;
                    case ItemBindType.BindToAccount:
                        bindType = "Binds on Account";
                        break;
                    case ItemBindType.Unbound:
                        bindType = "Unbound";
                        break;
                    default:
                        break;
                }*/
                if (bindType == null)
                {
                    itemInfoBinding.Visibility = Visibility.Collapsed;
                }
                else
                {
                    itemInfoBinding.Visibility = Visibility.Visible;
                    itemInfoBinding.Text = bindType;
                }

                itemInfoDescription.Text = "";
                /* foreach (ItemSpell spell in detailedItem.itemSpells)
                 {
                     itemInfoDescription.Text += spell.Spell.Description + "\n\n";
                 }
                 if (itemInfoDescription.Text == "")
                 {
                     itemInfoDescription.Visibility = Visibility.Collapsed;
                 }
                 else
                 {
                     itemInfoDescription.Text.Trim();
                     itemInfoDescription.Visibility = Visibility.Visible;
                 }*/
                //itemInfoDescription.Text = detailedItem.ItemSpells.ElementAt(0).Spell.Description;


                itemInfoSlot.Text = slot;
                if (equipedItem.Armor > 0)
                {
                    itemInfoArmor.Text = equipedItem.Armor + " Armor";
                    itemInfoArmor.Visibility = Visibility.Visible;
                }
                else
                {
                    itemInfoArmor.Visibility = Visibility.Collapsed;
                }



                /* if (detailedItem.ItemSet != null)
                 {
                     itemInfoSetBonus.Visibility = Visibility.Visible;
                     itemInfoSetBonus.Blocks.Clear();


                     foreach (ItemSetBonus bonus in detailedItem.ItemSet.Bonuses)
                     {
                         int itemSetCount = 0;
                         foreach (KeyValuePair<EquippedItem, Item> entry in itemDictionary)
                         {
                             if (entry.Value.ItemSet != null && entry.Value.ItemSet.Id == detailedItem.ItemSet.Id)
                             {
                                 itemSetCount++;
                             }
                         }


                         Run bonusText = new Run();
                         if (itemSetCount < bonus.Threshold)
                         {
                             bonusText.Foreground = new SolidColorBrush(Windows.UI.Colors.Gray);
                         }
                         bonusText.FontSize = 14;
                         bonusText.Text = "Set (" + bonus.Threshold + "): " + bonus.Description + "\n";

                         // Create a paragraph and add the Run and Bold to it.
                         Paragraph myParagraph = new Paragraph();
                         myParagraph.Inlines.Add(bonusText);
                         itemInfoSetBonus.Blocks.Add(myParagraph);
                     }
                 }
                 else
                 {
                     itemInfoSetBonus.Visibility = Visibility.Collapsed;
                 }
             }
             else
             {
                 itemInfoSetBonus.Visibility = Visibility.Collapsed;
                 itemInfoBinding.Visibility = Visibility.Collapsed;
                 itemInfoDescription.Visibility = Visibility.Collapsed;
             }// END IF ELSE detailedInfo != null
                 */
                StringBuilder stats = new StringBuilder();
                /*ItemState? reforgedFrom = equipedItem.TooltipParams.Reforge;
                ItemStatType? reforgedTo = equipedItem.TooltipParams.ReforgedFromStat;
                for (int i = 0; i < equipedItem.Stats.Count; i++)
                {
                    ItemStat stat = equipedItem.Stats.ElementAt(i);
                    stats.Append("+" + stat.Amount + " " + stat.StatType.ToString().Replace("Rating", ""));
                    if (reforgedTo != null && stat.StatType == reforgedTo)
                    {
                        stats.Append(" (Reforged from " + reforgedFrom.Value.ToString().Replace("Rating", "") + ")");
                    }
                    stats.Append("\n");
                }
                    */


                itemInfoStats.Text = stats.ToString();
                itemInfoFrame.Visibility = Visibility.Visible;
                //itemInfoFrame.InvalidateMeasure();
                itemInfoFrame.UpdateLayout();
                var ttv = image.TransformToVisual(Window.Current.Content);
                Point screenCoords = ttv.TransformPoint(new Point(0, 0));
                Thickness margin = itemInfoFrame.Margin;
                if (screenCoords.Y + itemInfoFrame.RenderSize.Height + 15 >= Window.Current.Bounds.Height)
                {
                    margin.Top = screenCoords.Y + image.RenderSize.Height - itemInfoFrame.RenderSize.Height;

                }
                else
                {

                    margin.Top = screenCoords.Y;
                }

                if (screenCoords.X + itemInfoFrame.ActualWidth >= characterItemsSection.RenderSize.Width)
                {
                    margin.Left = screenCoords.X - itemInfoFrame.ActualWidth - 20;
                }
                else
                {
                    margin.Left = screenCoords.X + image.ActualWidth + 20;
                }


                itemInfoFrame.Margin = margin;
            }
        }
        private void equippedItemHelper(Image image, EquippedItem item)
        {
            if (item == null)
            {

                image.Opacity = 0.5;
                (image.Parent as Border).Opacity = 0.5;
                return;
            }

            image.Source = new BitmapImage(new Uri(sourceSting + item.Icon + ".jpg", UriKind.Absolute));
            Border border = image.Parent as Border;
            /* switch (item.Quality)
             {

                 case ItemQuality.Common:
                     border.BorderBrush = new SolidColorBrush(Windows.UI.Colors.White);
                     break;
                 case ItemQuality.Uncommon:
                     border.BorderBrush = new SolidColorBrush(Windows.UI.Colors.Green);
                     break;
                 case ItemQuality.Rare:
                     border.BorderBrush = new SolidColorBrush(Windows.UI.Colors.Blue);
                     break;
                 case ItemQuality.Epic:
                     border.BorderBrush = new SolidColorBrush(Windows.UI.Colors.Purple);
                     break;
                 case ItemQuality.Legendary:
                     border.BorderBrush = new SolidColorBrush(Windows.UI.Colors.Orange);
                     break;
                 case ItemQuality.Artifact:
                     border.BorderBrush = new SolidColorBrush(Windows.UI.Colors.LightGoldenrodYellow);
                     break;
                 case ItemQuality.Heirloom:
                     border.BorderBrush = new SolidColorBrush(Windows.UI.Colors.LightGoldenrodYellow);
                     break;
             }*/
        }