internal void ExecuteStop(object param = null) { if (CardsSeen.Count == 0 && IsNoCardTurnedYet()) { return; } var cardsMemorized = CardsSeen.ToList(); if (IsCurrentCardVisible) { cardsMemorized.Add(CurrentCard); } RaiseMemorizationCompleted(cardsMemorized); }
internal void ExecuteTurnCard(object param = null) { var isCurrentCardVisibleBefore = IsCurrentCardVisible; var canExecuteStop = CanExecuteStop(); var canExecute = CanExecuteTurnCard(param); if (IsNoCardTurnedYet()) { _timeTracker.Start(); } else { CardsSeen.Add(CurrentCard); } if (_deck.HasMoreCards()) { _deck.TurnCard(); CurrentCard = _deck.CurrentCard; } else { CurrentCard = null; } RaisePropertyChanged("CardsNotSeenCount"); if (canExecute != CanExecuteTurnCard(param)) { TurnCardCommand.RaiseCanExecuteChanged(); } if (isCurrentCardVisibleBefore != IsCurrentCardVisible) { RaisePropertyChanged("IsCurrentCardVisible"); } if (canExecuteStop != CanExecuteStop()) { StopCommand.RaiseCanExecuteChanged(); } if (!_deck.HasMoreCards()) { RaisePropertyChanged("IsLastCard"); } }