private void InnerAnimateMove(Move move, Queem.Core.Figure figureDied)
{
var uniformGrid = mainGrid.FindChild<UniformGrid>();
var moveGrid = uniformGrid.Children.OfType<ContentPresenter>()
.Where((child) =>
(child.DataContext as SquareItem).Square == move.From)
.First();
int zIndex = Panel.GetZIndex(moveGrid);
// set zIndex over 9000
Panel.SetZIndex(moveGrid, 9001);
this.viewModel.AnimateMove(move,
moveGrid.ActualWidth,
(sourceItem) =>
{
if (figureDied != Queem.Core.Figure.Nobody)
sourceItem.UpdateChessFigure(figureDied,
this.viewModel.CurrentPlayerColor.GetOpposite());
Panel.SetZIndex(moveGrid, zIndex);
this.animationsDone += 1;
if (this.animationsDone == this.desiredAnimationsCount)
this.OnMoveAnimationFinished();
});
}