private void SavePathBrowserButton_Click(object sender, RoutedEventArgs e) { FolderBrowserDialog folderDialog = new FolderBrowserDialog { ShowNewFolderButton = true, SelectedPath = savePathInput.Text, Description = SaveLabText.FolderDialogDescription }; // loop until user chooses a folder, or click "Cancel" button while (true) { // this launcher will scroll the view to selected path DialogResult folderDialogResult = FolderDialogLauncher.ShowFolderBrowser(folderDialog); if (folderDialogResult == Forms.DialogResult.OK) { string newPath = folderDialog.SelectedPath; savePathInput.Text = newPath; break; } else { // if user cancels the dialog, break the loop break; } } }
private void SavePathBrowserButton_Click(object sender, RoutedEventArgs e) { FolderBrowserDialog folderDialog = new FolderBrowserDialog { ShowNewFolderButton = true, SelectedPath = savePathInput.Text, Description = ShapesLabText.FolderDialogDescription }; // loop until user chooses an empty folder, or click "Cancel" button while (true) { // this launcher will scroll the view to selected path DialogResult folderDialogResult = FolderDialogLauncher.ShowFolderBrowser(folderDialog); if (folderDialogResult == Forms.DialogResult.OK) { string newPath = folderDialog.SelectedPath; if (!FileDir.IsDirectoryEmpty(newPath)) { System.Windows.MessageBox.Show(ShapesLabText.ErrorFolderNonEmpty); } else { savePathInput.Text = newPath; break; } } else { // if user cancels the dialog, break the loop break; } } }