public DeckRegularDict <D> ListSelectedObjects(bool alsoRemove) // i think its okay to return a list of for this. (well see)
        {
            DeckRegularDict <D> newList = HandList.Where(Items => Items.IsSelected == true).ToRegularDeckDict();

            if (alsoRemove == true)
            {
                HandList.RemoveSelectedItems(); //this works too.
            }
            return(newList);
        }
Example #2
0
 protected virtual async void AfterCollectionChange()
 {
     if (ObjectList.Any(Items => Items.Drew == true))
     {
         var thisObject = ObjectList.Where(Items => Items.Drew == true).Take(1).Single();
         var firstDeck  = FindControl(thisObject);
         try
         {
             await ThisScroll !.ScrollToAsync(firstDeck, ScrollToPosition.Center, false);
         }
         catch
         {
             //try to ignore.  if worse comes to worst, just won't autoscroll.
         }
     }
     else
     {
         await ThisScroll !.ScrollToAsync(0, 0, false);
     }
 }
        private int WhoWonTrick(DeckObservableDict <HorseshoeCardGameCardInformation> thisCol)
        {
            if (thisCol.Count != 4)
            {
                throw new BasicBlankException("Must have 4 cards for the trick list to see who won");
            }
            var thisCard           = thisCol.First();
            int begins             = thisCard.Player;
            EnumCardValueList nums = thisCard.Value;

            if (thisCol.All(Items => Items.Value == nums))
            {
                return(begins);
            }
            DeckRegularDict <HorseshoeCardGameCardInformation> playerStarted = new DeckRegularDict <HorseshoeCardGameCardInformation>();
            DeckRegularDict <HorseshoeCardGameCardInformation> otherPlayer   = new DeckRegularDict <HorseshoeCardGameCardInformation>();

            playerStarted.Add(thisCol.First());
            playerStarted.Add(thisCol.Last());
            otherPlayer.Add(thisCol[1]);
            otherPlayer.Add(thisCol[2]);
            HorseshoeCardGameCardInformation firstCard  = playerStarted.First();
            HorseshoeCardGameCardInformation secondCard = playerStarted.Last();
            EnumSuitList      whichSuit = firstCard.Suit;
            EnumCardValueList pairAmount;
            EnumCardValueList highestSuitNumber = EnumCardValueList.None;
            int possibleWinPlayer = 0;

            if (firstCard.Value == secondCard.Value)
            {
                pairAmount = firstCard.Value;
            }
            else
            {
                pairAmount = EnumCardValueList.None;
                var card = thisCol.Where(x => x.Suit == whichSuit).OrderByDescending(x => x.Value).Take(1).Single();
                highestSuitNumber = card.Value;
                possibleWinPlayer = card.Player;
                //if (secondCard.Value > firstCard.Value && secondCard.Suit == firstCard.Suit)
                //    highestSuitNumber = secondCard.Value;
                //else if (secondCard.Suit == firstCard.Suit)
                //    highestSuitNumber = firstCard.Value;
            }
            firstCard  = otherPlayer.First();
            secondCard = otherPlayer.Last();
            if (firstCard.Value != secondCard.Value && pairAmount > 0)
            {
                return(begins);
            }
            if (firstCard.Value == secondCard.Value)
            {
                if (firstCard.Value > pairAmount)
                {
                    if (begins == 1)
                    {
                        return(2);
                    }
                    return(1);
                }
            }
            if (pairAmount > 0)
            {
                return(begins);
            }

            if (possibleWinPlayer == 0)
            {
                throw new BasicBlankException("Sombody had to win it");
            }
            return(possibleWinPlayer);
            //if (firstCard.Suit == whichSuit)
            //{
            //    if (firstCard.Value > highestSuitNumber)
            //    {
            //        if (begins == 1)
            //            return 2;
            //        return 1;
            //    }
            //}
            //if (secondCard.Suit == whichSuit)
            //{
            //    if (secondCard.Value > highestSuitNumber)
            //    {
            //        if (begins == 1)
            //            return 2;
            //        return 1;
            //    }
            //}
            //return begins;
        }