//上传动作 private void DoUploadWork(object sender, DoWorkEventArgs e) { UploadArg fileNames = e.Argument as UploadArg; FSClient fs = new FSClient(); fs.MutUpload(worker, fileNames.FilePathList, ConfigHelper.HdfsRoot + CurrentPath, fileNames.LocalFileRoot); }
//点击 上传文件夹 private void MenuItemUploadFloder_Click(object sender, EventArgs e) { UploadArg fileNames = GetFilesInFolder(); if (fileNames.FilePathList.Count > 0) { worker.DoWork += new DoWorkEventHandler(DoUploadWork); worker.ProgressChanged += new ProgressChangedEventHandler(ProgessChanged); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(CompleteUploadWork); worker.RunWorkerAsync(fileNames); } }
private UploadArg GetFilesInFolder() { UploadArg ua = new UploadArg(); FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog(); //folderBrowserDialog.RootFolder = System.Environment.SpecialFolder.Desktop; DialogResult results = folderBrowserDialog.ShowDialog(); if (results == DialogResult.OK) { try { string pathName = folderBrowserDialog.SelectedPath; GetFilesFromDic(pathName, ua.FilePathList); ua.LocalFileRoot = pathName; } catch (Exception ex) { MessageBox.Show("错误: 读取文件失败。 " + ex.Message); } } return(ua); }
private UploadArg GetFilesInFolder() { UploadArg ua = new UploadArg(); FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog(); //folderBrowserDialog.RootFolder = System.Environment.SpecialFolder.Desktop; DialogResult results = folderBrowserDialog.ShowDialog(); if (results == DialogResult.OK) { try { string pathName = folderBrowserDialog.SelectedPath; GetFilesFromDic(pathName, ua.FilePathList); ua.LocalFileRoot = pathName; } catch (Exception ex) { MessageBox.Show("错误: 读取文件失败。 " + ex.Message); } } return ua; }
//上传动作 private void DoUploadWork(object sender, DoWorkEventArgs e) { UploadArg fileNames = e.Argument as UploadArg; client.MutUpload(worker, fileNames.FilePathList, CurrentPath, fileNames.LocalFileRoot); }