/// <summary> /// Handle the Click event of btnDownload. /// </summary> private void btnDownload_Click(object sender, EventArgs e) { // One or more files / folders should be selected in the File Explorer. if (lstFileExplorer.SelectedItems.Count == 0) { MessageBox.Show( "Please select one or more files / folders in the File Explorer", "No file is selected"); return; } // If the tbDownloadPath.Text is empty, then show a FolderBrowserDialog. if (string.IsNullOrEmpty(tbDownloadPath.Text) && BrowserDownloadPath() != System.Windows.Forms.DialogResult.OK) { return; } var directoriesAndFiles = lstFileExplorer.SelectedItems.Cast <FTPFileSystem>().ToList(); // Download the selected items. client.DownloadDirectoriesAndFiles(directoriesAndFiles, tbDownloadPath.Text); }
/// <summary> ///处理btnDownload的Click事件. /// </summary> private void btnDownload_Click(object sender, EventArgs e) { //在文件资源管理器中一个或者多个文件或文件夹被选择。 if (lstFileExplorer.SelectedItems.Count == 0) { MessageBox.Show( "在文件资源管理器中请选择一个或多个文件/文件夹", "没有被选择的文件"); return; } //如果这个tbDownloadPath.Text文本是空的时,就显示一个文件夹浏览对话框。 if (string.IsNullOrWhiteSpace(tbDownloadPath.Text) && BrowserDownloadPath() != System.Windows.Forms.DialogResult.OK) { return; } var directoriesAndFiles = lstFileExplorer.SelectedItems.Cast <FTPFileSystem>(); //下载这个选中的项目. client.DownloadDirectoriesAndFiles(directoriesAndFiles, tbDownloadPath.Text); }