コード例 #1
0
        /// <summary>
        /// handles the event when the user clicks "Combine" button
        /// validates the list and starts the combine function
        /// </summary>
        /// <param name="sender">the button</param>
        /// <param name="e">event arguments</param>
        private void btnCombine_Click(object sender, EventArgs e)
        {
            sfDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            sfDialog.Title            = "Select where you want the output file and the name of the new file...";
            sfDialog.Filter           = "PDF Files|*.pdf";
            var result = sfDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                List <PdfFileList.FileListRow> rows = new List <PdfFileList.FileListRow>();
                foreach (PdfFileList.FileListRow row in this.fileList.FileList.Rows)
                {
                    rows.Add(row);
                }
                try
                {
                    Combine.Start(rows, sfDialog.FileName);
                    MessageBox.Show(this, "Success");
                    this.fileList = new PdfFileList();
                    this.lbFileList.Items.Clear();
                }
                catch (Exception x)
                {
                    MessageBox.Show(this, x.Message, "Something went wrong...");
                }
            }
        }