private void combineFiles(string saveFileName, out int countFilesBound, out string diagnostic) { diagnostic = ""; using (var combiner = new Combiner(saveFileName)) { progressBar.Visible = true; this.Enabled = false; int i = 0; foreach (PdfItem pi in FileListPanel.Controls) { try { byte[] pw; bool found_pw = passwords.TryGetValue(pi.FileName, out pw); if (found_pw && pw != null) { combiner.AddFile(pi.FileName, pw, pi.PageDescriptor); } else { combiner.AddFile(pi.FileName, new byte[0], pi.PageDescriptor); } } catch (PdfException pdfe) { diagnostic += pi.FileName + ": " + pdfe.Message + "\n"; } i += 1; progressBar.Value = (int)(((i) / (double)FileListPanel.Controls.Count) * 100); } countFilesBound = i; return; } }
private void combineButton_Click(object sender, EventArgs e) { if (saveFileDialog.ShowDialog() == DialogResult.OK) { using (var combiner = new Combiner(saveFileDialog.FileName)) { progressBar.Visible = true; this.Enabled = false; for (int i = 0; i < inputListBox.Items.Count; i++) { combiner.AddFile((string)inputListBox.Items[i],i+1); progressBar.Value = (int)(((i + 1) / (double)inputListBox.Items.Count) * 100); } this.Enabled = true; progressBar.Visible = false; } System.Diagnostics.Process.Start(saveFileDialog.FileName); } }
private void combineButton_Click(object sender, EventArgs e) { if (saveFileDialog.ShowDialog() == DialogResult.OK) { using (var combiner = new Combiner(saveFileDialog.FileName)) { progressBar.Visible = true; this.Enabled = false; for (int i = 0; i < inputListBox.Items.Count; i++) { combiner.AddFile((string)inputListBox.Items[i]); progressBar.Value = (int)(((i + 1) / (double)inputListBox.Items.Count) * 100); } this.Enabled = true; progressBar.Visible = false; } System.Diagnostics.Process.Start(saveFileDialog.FileName); } }