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; } }
public virtual Card CardFromShape(CardShape shape) { var str = shape.GetCardFace(); foreach (var card in AllCards()) { if (card.ToString() == str) { return(card); } } return(null); }
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); } } }
public void CancelDrag(CardShape draggedCard) { _dragsInLimbo.Remove(draggedCard); draggedCard.HighlightOnVisibility = true; draggedCard.Visibility = System.Windows.Visibility.Visible; }
public CardDropEventArgs(CardShape cardShape, MouseEventArgs mouseEventArgs, RoutedEvent routedEvent, object source) : base(routedEvent, source) { Init(cardShape, mouseEventArgs); }
public CardDropEventArgs(CardShape cardShape, MouseEventArgs mouseEventArgs, RoutedEvent routedEvent) : base(routedEvent) { Init(cardShape, mouseEventArgs); }
private void Init(CardShape cardShape, MouseEventArgs mouseEventArgs) { this.CardShape = cardShape; this.MouseEventArgs = mouseEventArgs; }
public CardDropEventArgs(CardShape cardShape, MouseEventArgs mouseEventArgs) { Init(cardShape, mouseEventArgs); }