in Games/Memory/GamePage.xaml.cs [415:469]
async void ResetBoard()
{
PlayAgainText.Visibility = Visibility.Collapsed;
_gameOver = false;
_firstButton = null;
_secondButton = null;
_numMoves = 0;
MoveCountTextBlock.Text = _numMoves.ToString();
_remaining = _boardRows * _boardColumns;
var pairs = (_boardRows * _boardColumns) / 2;
List<string> listContent;
if (_usePictures)
{
try
{
listContent = await GetPicturesContent(pairs);
}
catch
{
listContent = GetSymbolContent(pairs);
_usePictures = false;
}
}
else
{
listContent = GetSymbolContent(pairs);
}
List<Button> listButtons = ShuffleList(GetButtonList());
var compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;
if (_resetBatchAnimation != null)
{
_resetBatchAnimation.Completed -= ResetBatchAnimation_Completed;
_resetBatchAnimation.Dispose();
}
_resetBatchAnimation = compositor.CreateScopedBatch(CompositionBatchTypes.Animation);
_resetBatchAnimation.Completed += ResetBatchAnimation_Completed; ;
foreach (Button button in listButtons)
{
FlipCardFaceDown(button);
GazeInput.SetInteraction(button, Interaction.Inherited);
}
_resetBatchAnimation.End();
for (int i = 0; i < _boardRows * _boardColumns; i += 2)
{
listButtons[i].Tag = listContent[i / 2];
listButtons[i + 1].Tag = listContent[i / 2];
}
}