예제 #1
0
 private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
    if (e.Source is Card)
    {
       currentCard = (Card)e.Source;
       offset = Mouse.GetPosition(currentCard);
       contentGrid.Children.Remove(currentCard);
    }
    else
    {
       currentCard = new Card
       {
          Suit = Card.Suits[random.Next(0, 4)],
          Rank = random.Next(1, 13)
       };
       currentCard.HorizontalAlignment = HorizontalAlignment.Left;
       currentCard.VerticalAlignment = VerticalAlignment.Top;
       offset = new Point(50, 75);
    }
    contentGrid.Children.Add(currentCard);
    PositionCard();
 }
예제 #2
0
 private void Grid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
    currentCard = null;
 }