예제 #1
0
        /// <summary>Dismiss current card and fetch next one.</summary>
        /// <returns>Whether any cards are available</returns>
        /// <exception cref="System.InvalidOperationException">No card available (Current is null).</exception>
        public Task <bool> DismissAsync()
        {
            Card card = Current;

            if (card == null)
            {
                throw new InvalidOperationException("Card unavailable");
            }

            NextAction[CurrentList] = () => CurrentList.DismissAsync();
            CurrentList             = null;

            // Create review log before dismiss
            ReviewLog log = CreateLog(card);

            // Actually dismiss card
            CardAction cardAction = card.Dismiss();

            // Complete log with updated values
            CompleteLog(log, card, Grade.Dismiss);

#pragma warning disable 4014
            // Save changes to Database
            UpdateCardAsync(log, card, cardAction);
#pragma warning restore 4014

            return(DoNextAsync());
        }