Example #1
0
        // This binds the item at the current location
        // or indicates if the item is empty

        public void ShowItemLocation()
        {
            // Getting the Character by ID
            var charName = _viewModel.BattleEngine.PlayerCurrent.Name;
            var currChar = _viewModel.GetByName(charName);

            List <Item> itemByLocation = new List <Item>();
            // Getting Item from each Location in Character

            // Head slot
            Item currItem = currChar.GetItemByLocation(ItemLocationEnum.Head);

            if (currItem != null)
            {
                itemByLocation.Add(currItem);
                ItemHead.Text        = currItem.Name;
                ItemHeadImage.Source = currItem.ImageURI;
            }
            else
            {
                ItemHead.Text = "Empty";
            }


            // Necklass slot
            currItem = currChar.GetItemByLocation(ItemLocationEnum.Necklass);
            if (currItem != null)
            {
                itemByLocation.Add(currItem);
                ItemNecklass.Text        = currItem.Name;
                ItemNecklassImage.Source = currItem.ImageURI;
            }
            else
            {
                ItemNecklass.Text = "Empty";
            }


            // PrimaryHand slot
            currItem = currChar.GetItemByLocation(ItemLocationEnum.PrimaryHand);
            if (currItem != null)
            {
                itemByLocation.Add(currItem);
                ItemPrimaryHand.Text        = currItem.Name;
                ItemPrimaryHandImage.Source = currItem.ImageURI;
            }
            else
            {
                ItemPrimaryHand.Text = "Empty";
            }

            // OffHand slot

            currItem = currChar.GetItemByLocation(ItemLocationEnum.OffHand);
            if (currItem != null)
            {
                itemByLocation.Add(currItem);
                ItemOffHand.Text        = currItem.Name;
                ItemOffHandImage.Source = currItem.ImageURI;
            }
            else
            {
                ItemOffHand.Text = "Empty";
            }

            // LeftFinger slot
            currItem = currChar.GetItemByLocation(ItemLocationEnum.LeftFinger);
            if (currItem != null)
            {
                itemByLocation.Add(currItem);
                ItemLeftFinger.Text        = currItem.Name;
                ItemLeftFingerImage.Source = currItem.ImageURI;
            }
            else
            {
                ItemLeftFinger.Text = "Empty";
            }

            // Right Finger slot
            currItem = currChar.GetItemByLocation(ItemLocationEnum.RightFinger);
            if (currItem != null)
            {
                itemByLocation.Add(currItem);
                ItemRightFinger.Text        = currItem.Name;
                ItemRightFingerImage.Source = currItem.ImageURI;
            }
            else
            {
                ItemRightFinger.Text = "Empty";
            }

            // Feet slot
            currItem = currChar.GetItemByLocation(ItemLocationEnum.Feet);
            if (currItem != null)
            {
                itemByLocation.Add(currItem);
                ItemFeet.Text        = currItem.Name;
                ItemFeetImage.Source = currItem.ImageURI;
            }
            else
            {
                ItemFeet.Text = "Empty";
            }
        }