Example #1
0
 private void btnNewCard_Click(object sender, RoutedEventArgs e)
 {
     this.card = cardDatabase.GetCard(CardType.PromptBlack);
     Utility.DrawHand(this.canvas, new List <Card> {
         this.card
     });
 }
Example #2
0
        private void canvas_MouseUp(object sender, MouseButtonEventArgs e)
        {
            Point mousePos = e.GetPosition(canvas);

            if (mousePos.Y <= CARD_HEIGHT)
            {
                // was a card clicked? ignore space between them
                for (int position = 0; position < this.HandOfCards.Count; position++)
                {
                    var cardX = position * (CARD_SPACING + CARD_WIDTH);

                    if (cardX <= mousePos.X && mousePos.X <= cardX + CARD_WIDTH)
                    {
                        var card = this.HandOfCards[position];

                        if (selectedCard.HasValue && selectedCard.Value == position)
                        {
                            // we already had it selected. copy the text!
                            Clipboard.SetText(card.CardText);

                            // do a little notification
                            sbLabel.Content = "Copied card text to clipboard";
                            this.timer.Start();

                            // get a new card and stick it in the same position
                            this.HandOfCards[position] = cardDatabase.GetCard(CardType.ResponseWhite);
                            selectedCard = null;
                        }
                        else
                        {
                            // select this card
                            selectedCard = position;
                        }

                        Utility.DrawHand(canvas, this.HandOfCards, selectedCard);
                        break;
                    }
                }
            }
        }
Example #3
0
        private void StartNewGame_Click(object sender, RoutedEventArgs e)
        {
            Decks decksToUse = (Decks)0;

            for (int i = 0; i < Card.NUM_DECKS_AVAILABLE; i++)
            {
                var mi = FileDecks.Items[i] as MenuItem;
                if (mi.IsChecked)
                {
                    var deck = (Decks)mi.Tag;
                    decksToUse |= deck;
                }
            }

            this.selectedCard = null;
            this.cardDatabase = new CardDatabase(decksToUse);
            this.HandOfCards  = Enumerable
                                .Range(0, HandSize)
                                .Select(i => cardDatabase.GetCard(CardType.ResponseWhite))
                                .ToList();

            Utility.DrawHand(canvas, this.HandOfCards);
        }