void GenerateListClick(object sender, RoutedEventArgs e) { System.Windows.Forms.FolderBrowserDialog folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); folderBrowserDialog.ShowNewFolderButton = true; System.Windows.Forms.DialogResult result = folderBrowserDialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { string path = folderBrowserDialog.SelectedPath; string filename; if (SetSavedFileNameWindow.ShowDialog(out filename)) { string fullpath = Path.Combine(path, filename); using (StreamWriter writer = new StreamWriter(fullpath, true)) { foreach (Result r in ResultsCollection) { writer.WriteLine($"{r.VoiceName} = {r.SpeechName.Replace(".PROCESSED", "")}, {r.Index}"); } } } } //Window.Close(); }
public static bool ShowDialog(out string filename) { SetSavedFileNameWindow win = new SetSavedFileNameWindow(); win.ShowDialog(); if (win.Accepted) { filename = win.FileNameTextBox.Text; return(true); } else { filename = null; return(false); } }
void GenerateCodeClick(object sender, RoutedEventArgs e) { System.Windows.Forms.FolderBrowserDialog folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); folderBrowserDialog.ShowNewFolderButton = true; System.Windows.Forms.DialogResult result = folderBrowserDialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { string path = folderBrowserDialog.SelectedPath; string filename; if (SetSavedFileNameWindow.ShowDialog(out filename)) { string fullpath = Path.Combine(path, filename); GenCode(fullpath); } } //Window.Close(); }