private void SaveButton_Click(object sender, RoutedEventArgs e) { if (grantTrees.filteredTree == null) { Console.WriteLine("Der Baum muss vor dem Speichern gefiltert werden."); return; } // Configure save file dialog box Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.FileName = GuiFunctions.cleanInput("filteredTree_" + strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(grantTrees.filteredTree)).properties.nameFiltered); // Default file name dlg.DefaultExt = ".grant"; // Default file extension dlg.Filter = "GRANT documents (.grant)|*.grant"; // Filter files by extension dlg.OverwritePrompt = true; // Hinweis wird gezeigt, wenn die Datei schon existiert dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); // Show save file dialog box Nullable <bool> result = dlg.ShowDialog(); // Process save file dialog box results if (result == true) { // Save document guiFunctions.saveProject(dlg.FileName); } }