private void BuyButton_Click(object sender, RoutedEventArgs e)
        {
            Marketplace marketplace  = Marketplace.Instance;
            List <Ride> buyableRides = marketplace.GetBuyableRides(park.ParkInventory);

            var item = ShopList.SelectedItem;

            if (item != null)
            {
                for (int i = 0; i < buyableRides.Count(); i++)
                {
                    if (item.ToString() == buyableRides[i].Name)
                    {
                        Ride ride = buyableRides[i] as Ride;
                        if (park.ParkWallet.Balance < ride.Cost)
                        {
                            MessageBox.Show(string.Format("You do not have enough money to buy {0}!", ride.Name));
                            return;
                        }

                        if (park.ParkInventory.Contains(ride))
                        {
                            MessageBox.Show(string.Format("You already own {0}!", ride.Name));
                            return;
                        }
                        marketplace.Buy(ride, park.ParkWallet, park.ParkInventory);
                        RefreshRides();
                        RefreshBalance();
                    }
                }
            }
        }
        private void RefreshRides()
        {
            Marketplace marketplace  = Marketplace.Instance;
            List <Ride> buyableRides = marketplace.GetBuyableRides(park.ParkInventory);

            ridesListView.Items.Clear();

            // Prepare a list to add all the images to for rides.
            ridesListView.LargeImageList           = new ImageList();
            ridesListView.LargeImageList.ImageSize = new Size(64, 64);

            for (int i = 0; i < buyableRides.Count; i++)
            {
                Ride ride = buyableRides[i];

                ridesListView.LargeImageList.Images.Add((Image)ride.Image);

                ListViewItem rideListViewItem = new ListViewItem();
                rideListViewItem.Group = ridesListView.Groups[0];
                rideListViewItem.Text  = string.Format("{0}\r\n(${1})", ride.Name, ride.Cost);
                // Reference the image by it's index (weird that Microsoft designed it this way)
                rideListViewItem.ImageIndex = i;
                rideListViewItem.Tag        = ride;

                ridesListView.Items.Add(rideListViewItem);
            }
        }
        private void RefreshRides()
        {
            ShopList.Items.Clear();
            Marketplace marketplace       = Marketplace.Instance;
            List <Ride> buyableRides      = marketplace.GetBuyableRides(park.ParkInventory);
            int         buyableRidesCount = buyableRides.Count();

            for (int i = 0; i < buyableRidesCount; i++)
            {
                ShopList.Items.Add(buyableRides[i]);
            }

            NameLabel.Content     = "";
            DurationLabel.Content = "";
            CostLabel.Content     = "";
        }
        private void listView_Click(object sender, RoutedEventArgs e)
        {
            Marketplace marketplace  = Marketplace.Instance;
            List <Ride> buyableRides = marketplace.GetBuyableRides(park.ParkInventory);

            var item = (sender as ListView).SelectedItem;

            if (item != null)
            {
                Ride ride = item as Ride;

                NameLabel.Content     = "Name: " + ride.Name;
                DurationLabel.Content = "Duration: " + ride.Duration;
                EntryFee.Content      = "Entry Fee: " + ride.EntryFee.ToString();
            }
        }
        public void RefreshInventory()
        {
            InventoryList.Items.Clear();
            Marketplace marketplace         = Marketplace.Instance;
            List <Ride> InventoryRides      = marketplace.GetBuyableRides(Park.ParkInventory);
            int         inventoryRidesCount = park.ParkInventory.Rides.Count();

            for (int i = 0; i < inventoryRidesCount; i++)
            {
                if (park.ParkInventory.Rides == null)
                {
                    return;
                }
                else
                {
                    //InventoryList.Items.Add(park.ParkInventory.Rides[i].Name);
                    InventoryList.Items.Add(park.ParkInventory.Rides[i]);
                }
            }
        }
        private void listView_Click(object sender, RoutedEventArgs e)
        {
            Marketplace marketplace  = Marketplace.Instance;
            List <Ride> buyableRides = marketplace.GetBuyableRides(park.ParkInventory);

            var item = (sender as ListView).SelectedItem;

            if (item != null)
            {
                BuyButton.Visibility = Visibility.Visible;
                for (int i = 0; i < buyableRides.Count(); i++)
                {
                    if (item.ToString() == buyableRides[i].Name)
                    {
                        Ride ride = buyableRides[i] as Ride;

                        NameLabel.Content     = "Name: " + buyableRides[i].Name;
                        DurationLabel.Content = "Duration: " + buyableRides[i].Duration;
                        CostLabel.Content     = "Cost: " + buyableRides[i].Cost;
                    }
                }
            }
        }