void OnNewGame()
        {
            isCreatingNewGame = true;
            FoundCardCount = 0;
            MoveCount = 0;
            firstSelectedCard = null;
            secondSelectedCard = null;
            var cardCountValue = GetCardCountValue();
            var halfCardCountValue = cardCountValue / 2;

            var cards = new MemoryCardViewModel[cardCountValue];

            var cardIndexes = (from index in GetRange(cardCountValue)
                               orderby randomGenerator.NextDouble()
                               select index).ToArray();

            var currentCardIndex = 0;

            var memoryCards = (from Uri cardImageUri in defaultCardUriArray
                               select new MemoryCard()
                               {
                                   ImageUri = cardImageUri,
                               }).ToArray();

            for (int i = 0; i < halfCardCountValue; i++)
            {
                var firstCardViewModel = new MemoryCardViewModel(this);
                var secondCardViewModel = new MemoryCardViewModel(this);
                firstCardViewModel.Initialize(memoryCards[i], CardBackgroundImageUriString);
                secondCardViewModel.Initialize(memoryCards[i], CardBackgroundImageUriString);

                var firstCardIndex = cardIndexes[currentCardIndex];
                currentCardIndex++;
                var secondCardIndex = cardIndexes[currentCardIndex];
                currentCardIndex++;

                cards[firstCardIndex] = firstCardViewModel;
                cards[secondCardIndex] = secondCardViewModel;
            }

            CurrentGameCards = cards.ToList();

            isCreatingNewGame = false;
        }
 public void SelectCard(MemoryCardViewModel cardViewModel)
 {
     if (firstSelectedCard == null)
     {
         firstSelectedCard = cardViewModel;
     }
     else if (secondSelectedCard == null)
     {
         secondSelectedCard = cardViewModel;
         MoveCount++;
     }
     else if (secondSelectedCard.MemoryCard.Id == firstSelectedCard.MemoryCard.Id)
     {
         FoundCardCount++;
         firstSelectedCard = cardViewModel;
         secondSelectedCard = null;
     }
     else
     {
         var firstCard = firstSelectedCard;
         var secondCard = secondSelectedCard;
         firstCard.IsSelected = false;
         secondCard.IsSelected = false;
         firstSelectedCard = cardViewModel;
         secondSelectedCard = null;
     }
 }