private async void GenerateGeneration() { var world = GridControl1.boardGrid.GenerateNextGeneration(); if (recording) { await service.SaveBoardToDatabaseAsync(world); } GridControl1.LoadWorld(world); }
private void PlayRecording() { if (loadedGameBoards.Count > 0) { GridControl1.LoadWorld(loadedGameBoards[currentFrame]); currentFrame++; if (currentFrame >= loadedGameBoards.Count) { MessageBox.Show("Recording done..."); loadedGameBoards.Clear(); currentFrame = 0; GenerateNewWorld(); Stop(); } } }
private async void ListBoxSavedGames_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ListBoxSavedGames.SelectedIndex != -1) { Stop(); loadedGameBoards = await service.GetSavedGameFromDatabaseAsync((GameEntity)ListBoxSavedGames.SelectedItem); loadedGame = true; GameRecord.IsEnabled = false; if (loadedGameBoards.Count > 0) { GridControl1.LoadWorld(loadedGameBoards[0]); } } UpdatePlayButton(); }