/// <summary> /// Show an OpenFileDialog to let user choose a JSON file /// to load. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LoadButtonClick(object sender, RoutedEventArgs e) { PauseButtonClick(null, null); OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Title = "Load a 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.Load(filename); DrawBoard(); } }