Exemplo n.º 1
0
        public void HideCard(TR thisCard)
        {
            if (thisCard.Visible == false)
            {
                throw new BasicBlankException("This card was already invisible.  Should not allow to click on it");
            }
            int oldVisible = CardList.Count(Items => Items.Visible == false);

            thisCard.Visible    = false;
            thisCard.IsEnabled  = false;
            thisCard.IsSelected = false;
            var nums = NextCard(thisCard);

            if (nums > -1)
            {
                var newCard = CardList[nums];
                if (newCard.Deck == thisCard.Deck)
                {
                    throw new BasicBlankException("Can't be the same card");
                }
                newCard.IsUnknown = false;
                newCard.IsEnabled = true;
            }
            ;
            int newVisible = CardList.Count(Items => Items.Visible == false);

            if (oldVisible + 1 != newVisible)
            {
                throw new BasicBlankException("Only one card should have been invisible after hiding card.  Find out what happened");
            }
        }