コード例 #1
0
        private void FillResultItem(PAOItem item, PAOResultItem resultItem)
        {
            resultItem.Person = item.Person;
            resultItem.Action = item.Action;
            resultItem.Object = item.Object;

            if (item.RecallOk.HasValue)
            {
                if (item.RecallOk.Value)
                {
                    resultItem.RecallState = 1;
                }
                else
                {
                    resultItem.RecallState = 2;
                }
            }
        }
コード例 #2
0
        private void OnNextCards()
        {
            if (cardsLeft)
            {
                PersonCard = deck.GetNext();
                ActionCard = deck.GetNext();
                ObjectCard = deck.GetNext();

                RaisePropertyChange("PersonCard");
                RaisePropertyChange("ActionCard");
                RaisePropertyChange("ObjectCard");

                CurrentNumberOfCards += 3;

                // Check for blank cards.


                //var isEndOfDeck = (PersonCard == PlayingCard.Blank) || (ActionCard == PlayingCard.Blank) || (ObjectCard == PlayingCard.Blank);
                var isEndOfDeck = deck.IsEndOfDeck();
                if (isEndOfDeck)
                {
                    //TODO:  Switch to recall state!
                    InstructionText = "Well done!  Now prepare yourself for the recalling process. The list on the right shows the last cards later. What are the next three cards? Please click next when you are ready.";

                    RaisePropertyChange("InstructionText");

                    deck.ResetIndex();
                    cardsLeft = false;
                }
            }
            else
            {
                if (showEndOfDeck)
                {
                    PersonCard = PlayingCard.Deck;
                    ActionCard = PlayingCard.Deck;
                    ObjectCard = PlayingCard.Deck;

                    CurrentNumberOfCards = 0;
                    showEndOfDeck        = false;
                }
                else
                {
                    if (deck.IsEndOfDeck())
                    {
                        InstructionText = "Game Over. Please restart for the same deck or create a new one.";
                        RaisePropertyChange("InstructionText");
                    }
                    else
                    {
                        // Recall Mode
                        PersonCard = deck.GetNext();
                        ActionCard = deck.GetNext();
                        ObjectCard = deck.GetNext();

                        CurrentNumberOfCards += 3;

                        // Add the latest on top
                        var newRecentList = new List <PAOItem>();
                        var paoItem       = new PAOItem()
                        {
                            Person = PersonCard, Action = ActionCard, Object = ObjectCard
                        };
                        newRecentList.Add(paoItem);

                        newRecentList.AddRange(RecentCards);

                        RecentCards = new ObservableCollection <PAOItem>(newRecentList);
                        RaisePropertyChange("RecentCards");
                    }
                }


                RaisePropertyChange("PersonCard");
                RaisePropertyChange("ActionCard");
                RaisePropertyChange("ObjectCard");
            }

            RaisePropertyChange("CurrentNumberOfCards");

            // Trigger the Enabled / Disabled lifecycle of the OK and Failed buttons
            MarkAsFailed.Refresh();
            MarkAsOk.Refresh();
            StoreResult.Refresh();
        }