DdsPlay.Model.Deck.MakeAllCardsDragable C# (CSharp) Method

MakeAllCardsDragable() public method

Method to set the value of the IsDragable on all of the cards in the deck.
public MakeAllCardsDragable ( bool isDragable ) : void
isDragable bool if set to true [is dragable].
return void
        public void MakeAllCardsDragable(bool isDragable)
        {
            foreach (var t in Cards)
            {
                t.IsDragable = isDragable;
            }
        }

Usage Example

Example #1
0
        private void Start_Click(object sender, RoutedEventArgs e)
        {
            _dealer = new Deck(1, 13, GameShape.Game);

            _dealer.Shuffle(5);
            _dealer.MakeAllCardsDragable(false);
            _dealer.Enabled = true;
            _dealer.FlipAllCards();

            var pbn = Pbn.Text;

            // collection cards if any are out
            if (_dealer.Cards.Count < 52)
            {
                CollectCards();
            }
            _dealer.Shuffle(5);

            // deal 13 cards to each of the four players
            for (var cardCount = 0; cardCount < CardsPerPlayer; cardCount++)
            {
                _dealer.Draw(Player1Hand.Deck, 1);
                _dealer.Draw(Player2Hand.Deck, 1);
                _dealer.Draw(Player3Hand.Deck, 1);
                _dealer.Draw(Player4Hand.Deck, 1);
            }

            // turn over human player [4] hand
            Player4Hand.Deck.Sort();
            Player4Hand.Deck.MakeAllCardsDragable(true);
            Player4Hand.Deck.FlipAllCards();
        }