void btnCopy_Click(object sender, EventArgs e) { if (this.cbDeleted.Checked) { MessageBox.Show("复制数据不能包括已删除数据!请取消已删除数据重新检索后操作。"); return; } string destFolder = null; FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.ShowNewFolderButton = true; if (fbd.ShowDialog() == DialogResult.OK) { destFolder = fbd.SelectedPath; } else return; int count = this.pagerControl.RecordCount; DialogResult dr = MessageBox.Show("是否将检索到的【" + count + "】条数据复制到目录:" + destFolder + "中?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (dr != DialogResult.OK || string.IsNullOrEmpty(destFolder) || count == 0) { return; } CopyProgress copyProgress = new CopyProgress(destFolder, criteria); ProgressForm progressForm = new ProgressForm(copyProgress, count); progressForm.ShowDialog(FormFTPMain.Current); }
/// <summary> /// 构造函数 /// </summary> /// <param name="copyProgress"></param> /// <param name="count"></param> public ProgressForm(CopyProgress copyProgress, int count) { InitializeComponent(); this.count = count; this.copyProgress = copyProgress; recordPath = Path.Combine(this.copyProgress.destFolder, recordName); this.labelInfo.Text = "0%"; this.progressBar.Minimum = 0; this.progressBar.Maximum = count; copyProgress.ReportCopyProgress += new EventHandler<ProgressInfoEventArgs>(copyProgress_ReportCopyProgress); this.Shown += new EventHandler(ProgressForm_Shown); this.FormClosing += new FormClosingEventHandler(ProgressForm_FormClosing); }