private void ViewModel_PauseGame(object sender, EventArgs e) { model.PauseGame(); timer.Stop(); korobeiniki?.Stop(); if (MessageBox.Show("Game Paused\nPress OK to continue", "Game Paused", MessageBoxButton.OK) == MessageBoxResult.OK) { model.ContinueGame(); timer.Start(); if (korobeiniki == null) { korobeiniki = new SoundPlayer(@"..\Resources\Korobeiniki.wav"); // **TODO** Resource folder might not be in the right place } korobeiniki.PlayLooping(); } }
private async Task SaveGameAsync() { model.PauseGame(); timer.Stop(); korobeiniki?.Stop(); SaveFileDialog fileDialog = new SaveFileDialog(); fileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; fileDialog.RestoreDirectory = true; if (fileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string path = fileDialog.FileName; await model.SaveGameAsync(path); if (MessageBox.Show("Game Saved\nPress OK to continue game", "Game Saved", MessageBoxButtons.OK) == DialogResult.OK) { model.ContinueGame(); timer.Start(); if (korobeiniki == null) { korobeiniki = new SoundPlayer(@"..\Resources\Korobeiniki.wav"); } korobeiniki?.PlayLooping(); return; } } if (MessageBox.Show("Game Paused\nPress OK to continue game", "Game Paused", MessageBoxButtons.OK) == DialogResult.OK) { model.ContinueGame(); timer.Start(); if (korobeiniki == null) { korobeiniki = new SoundPlayer(@"..\Resources\Korobeiniki.wav"); } korobeiniki?.PlayLooping(); return; } }