示例#1
0
        void FanCanvas_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (e.Source is CardShape)
            {
                var card = (CardShape)e.Source;

                _dragOriginalPos  = GetMousePositionForDragCalculations(e);
                _cardBeingDragged = card;
            }
        }
示例#2
0
        public virtual Card CardFromShape(CardShape shape)
        {
            var str = shape.GetCardFace();

            foreach (var card in AllCards())
            {
                if (card.ToString() == str)
                {
                    return(card);
                }
            }

            return(null);
        }
示例#3
0
        void FanCanvas_PreviewMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (_cardBeingDragged != null)
            {
                _dragsInLimbo.Add(_cardBeingDragged);
                _cardBeingDragged = null;
                if (_isDrag)
                {
                    _isDrag = false;
                    AdornerLayerForDrag().Remove(_dragAdorner);
                    _dragAdorner = null;

                    this.ReleaseMouseCapture();

                    var dropEventArgs = new CardDropEventArgs(_dragsInLimbo.Last(), e, CardDropEvent, this);
                    RaiseEvent(dropEventArgs);
                }
            }
        }
示例#4
0
 public void CancelDrag(CardShape draggedCard)
 {
     _dragsInLimbo.Remove(draggedCard);
     draggedCard.HighlightOnVisibility = true;
     draggedCard.Visibility            = System.Windows.Visibility.Visible;
 }
示例#5
0
 public CardDropEventArgs(CardShape cardShape, MouseEventArgs mouseEventArgs, RoutedEvent routedEvent, object source)
     : base(routedEvent, source)
 {
     Init(cardShape, mouseEventArgs);
 }
示例#6
0
 public CardDropEventArgs(CardShape cardShape, MouseEventArgs mouseEventArgs, RoutedEvent routedEvent)
     : base(routedEvent)
 {
     Init(cardShape, mouseEventArgs);
 }
示例#7
0
 private void Init(CardShape cardShape, MouseEventArgs mouseEventArgs)
 {
     this.CardShape      = cardShape;
     this.MouseEventArgs = mouseEventArgs;
 }
示例#8
0
 public CardDropEventArgs(CardShape cardShape, MouseEventArgs mouseEventArgs)
 {
     Init(cardShape, mouseEventArgs);
 }