Beispiel #1
0
 private void BallClick(object sender, RoutedEventArgs e)
 {
     if (SourceCell == null)
     {
         SourceCell          = (Cell)sender;
         SourceCell.Selected = true;
     }
     else
     {
         TargetCell = (Cell)sender;
         if (BoardGrid.IsValidMove(SourceCell, TargetCell))
         {
             SourceCell.Filled = false;
             MakeMove();
         }
         else
         {
             SourceCell.Selected = false;
             if (SourceCell.Position == TargetCell.Position)
             {
                 SourceCell = null;
             }
             else
             {
                 SourceCell          = TargetCell;
                 SourceCell.Selected = true;
             }
             TargetCell = null;
         }
     }
 }
Beispiel #2
0
        private void BallDragEnter(object sender, DragEventArgs e)
        {
            e.DragUIOverride.IsGlyphVisible   = false;
            e.DragUIOverride.IsCaptionVisible = false;

            TargetCell = (Cell)sender;
            if (BoardGrid.IsValidMove(SourceCell, TargetCell))
            {
                e.AcceptedOperation = DataPackageOperation.Move;
            }
            else
            {
                e.AcceptedOperation = DataPackageOperation.None;
            }
        }