/// <summary> /// Open a SaveFileDialog to allow players to choose a location /// where the game will be saved. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveButtonClick(object sender, RoutedEventArgs e) { PauseButtonClick(null, null); SaveFileDialog openFileDialog = new SaveFileDialog(); openFileDialog.Title = "Save the game"; openFileDialog.FileName = "game"; openFileDialog.DefaultExt = ".json"; openFileDialog.Filter = "Text documents (.json)|*.json"; Nullable <bool> result = openFileDialog.ShowDialog(); if (result == true) { string filename = openFileDialog.FileName; game.Save(filename); } }