private void ShowPoke()                   //This part is updated
        {
            //ImageBrush ib = new ImageBrush();
            Player         x       = Player.Instance; //testing use
            List <Pokemon> pokedis = x.PETS;
            WrapPanel      pokeinfo;
            Rectangle      pokepic;
            TextBlock      pokedata;

            for (int i = 0; i < pokedis.Count; i++)
            {
                pokeinfo            = display.Children[i] as WrapPanel;
                pokepic             = pokeinfo.Children[0] as Rectangle;
                pokedata            = pokeinfo.Children[1] as TextBlock;
                pokeinfo.Visibility = Visibility.Visible;

                string temp = pokedis[i].NAME;
                temp                = char.ToLower(temp[0]).ToString() + temp.Substring(1);
                pokepic.Fill        = new ImageBrush(new BitmapImage(new Uri(@"pack://application:,,,/media/pokemon/" + temp + ".png")));
                pokedata.Text       = pokedis[i].NAME + "\nLv:" + pokedis[i].LV + "\nAtk:" + pokedis[i].ATK + " Def:" + pokedis[i].DEF + "\nHP:" + pokedis[i].HP + "/" + pokedis[i].MAXHP;
                pokedata.Foreground = Brushes.Yellow;
                AssistTool.RemoveRoutedEventHandlers(pokeinfo, MouseUpEvent);
                int index = i;
                pokeinfo.MouseUp += (sender, EventArgs) => { PokeSelect_Click(sender, EventArgs, pokedis[index]); };
            }
            for (int i = pokedis.Count; i < 8; i++)
            {
                pokeinfo            = display.Children[i] as WrapPanel;
                pokeinfo.Visibility = Visibility.Hidden;
            }
            MsgBlock.Text           = "Click on the Pokemon that you want to do something about";
            PokeOperator.Visibility = Visibility.Hidden;
        }
 //Remove events from the buttons
 private void PokeDeselect(Pokemon x)
 {
     AssistTool.RemoveRoutedEventHandlers(HealButton, Button.ClickEvent);
     AssistTool.RemoveRoutedEventHandlers(UpButton, Button.ClickEvent);
     AssistTool.RemoveRoutedEventHandlers(EvolveButton, Button.ClickEvent);
     AssistTool.RemoveRoutedEventHandlers(SellButton, Button.ClickEvent);
 }
        private void ShowItem()          //This part is updated
        {
            Player x = Player.Instance;  //testing use
            Dictionary <string, int> itemdis = x.ITEMS;
            WrapPanel iteminfo;
            Rectangle itempic;
            TextBlock itemdata;

            int j = 0;

            foreach (KeyValuePair <string, int> pair in itemdis)
            {
                if (pair.Value > 0)
                {
                    iteminfo            = display.Children[j] as WrapPanel;
                    itempic             = iteminfo.Children[0] as Rectangle;
                    itemdata            = iteminfo.Children[1] as TextBlock;
                    iteminfo.Visibility = Visibility.Visible;
                    j++;

                    itempic.Fill        = new ImageBrush(new BitmapImage(new Uri(@"pack://application:,,,/media/item/" + (pair.Key) + ".png")));
                    itemdata.Text       = pair.Key + "X" + pair.Value;
                    itemdata.Foreground = Brushes.Yellow;

                    AssistTool.RemoveRoutedEventHandlers(iteminfo, MouseUpEvent);
                    iteminfo.MouseUp += (sender, EventArgs) => { ItemSold_Click(sender, EventArgs, pair.Key); };   //elegant solution for click event with parameters
                }
            }

            for (int i = j; i < 8; i++)
            {
                iteminfo            = display.Children[j] as WrapPanel;
                iteminfo.Visibility = Visibility.Hidden;
            }
            MsgBlock.Text           = "Click Item, Sell Item, Each worths $100";
            PokeOperator.Visibility = Visibility.Hidden;
        }