private void SaveExerciseButton_Click(object sender, RoutedEventArgs e) { var saveFileDialog = new SaveFileDialog { Filter = "FEN files (*.fen)|*.fen" }; if (saveFileDialog.ShowDialog() == true) { var fen = GameController.GetFen(); var filename = saveFileDialog.FileName; File.WriteAllText(filename, fen); var keywordWindow = new KeywordWindow(); keywordWindow.ShowDialog(); var keywords = keywordWindow.Keywords; Index.AddFile(filename, keywords); ExerciseManager.AddExercise(filename, keywords); } }