void btnChooseFolder_Click(object sender, RoutedEventArgs e) { if (comboProvider.SelectedIndex == 0) { System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog(); if (!string.IsNullOrEmpty(txtImportFolderLocation.Text) && Directory.Exists(txtImportFolderLocation.Text)) { dialog.SelectedPath = txtImportFolderLocation.Text; } if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { txtImportFolderLocation.Text = dialog.SelectedPath; } } else { CloudFolderBrowser frm = new CloudFolderBrowser(); frm.Owner = this; frm.Init(importFldr, txtImportFolderLocation.Text); bool?result = frm.ShowDialog(); if (result.HasValue && result.Value) { txtImportFolderLocation.Text = frm.SelectedPath; } } }
void btnChooseFolder_Click(object sender, RoutedEventArgs e) { if (comboProvider.SelectedIndex == 0) { //needed check, if (CommonFileDialog.IsPlatformSupported) { var dialog = new CommonOpenFileDialog(); dialog.IsFolderPicker = true; if (!string.IsNullOrEmpty(txtImportFolderLocation.Text) && Directory.Exists(txtImportFolderLocation.Text)) { dialog.InitialDirectory = txtImportFolderLocation.Text; } if (dialog.ShowDialog() == CommonFileDialogResult.Ok) { txtImportFolderLocation.Text = dialog.FileName; } } else { FolderBrowserDialog dialog = new FolderBrowserDialog(); if (!string.IsNullOrEmpty(txtImportFolderLocation.Text) && Directory.Exists(txtImportFolderLocation.Text)) { dialog.SelectedPath = txtImportFolderLocation.Text; } if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { txtImportFolderLocation.Text = dialog.SelectedPath; } } } else { CloudFolderBrowser frm = new CloudFolderBrowser(); frm.Owner = this; frm.Init(importFldr, txtImportFolderLocation.Text); bool?result = frm.ShowDialog(); if (result.HasValue && result.Value) { txtImportFolderLocation.Text = frm.SelectedPath; } } }