public void AnimateMove(Move move, double width, Action<SquareItem> animationFinishedAction)
{
double deltaX = move.GetDeltaX() * width;
double deltaY = -move.GetDeltaY() * width;
var sourceItem = this.squareItems[move.From.GetRealIndex()];
var targetItem = this.squareItems[move.To.GetRealIndex()];
var figureMoving = sourceItem.FigureType;
sourceItem.AnimateShift(deltaX, deltaY, (item) =>
{
this.dispatcher.BeginInvoke(new Action(() =>
{
targetItem.UpdateChessFigure(item.FigureType, sourceItem.FigureColor);
sourceItem.UpdateChessFigure(Figure.Nobody, sourceItem.FigureColor);
sourceItem.ResetTransform();
animationFinishedAction(item);
}), DispatcherPriority.Render);
});
}