Exemplo n.º 1
0
 private void btnPdf_Click(object sender, EventArgs e)
 {
     if (selectedFileToUpdate != null)
     {
         try
         {
             _pdfSettings.FileName = selectedFileToUpdate.FileName;
             _pdfSettings.GetSourceFilePathEvent += _pdfSettings_GetSourceFilePathEvent;
             frmUpdatePdf frmUpdate = new frmUpdatePdf(_pdfSettings);
             frmUpdate.ShowDialog();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         try
         {
             _pdfSettings.FileName = txtPdfName?.Text;
             _pdfSettings.GetSourceFilePathEvent += PdfSettings_GetSourceFilePathEvent;
             frmAcceptPdf acceptPdf = new frmAcceptPdf(_pdfSettings);
             acceptPdf.ShowDialog();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemplo n.º 2
0
 private void btnViewPdf_Click(object sender, EventArgs e)
 {
     if (gridFiles.Rows.Count > 0)
     {
         //Find the selected id
         int selectedId = int.Parse(gridFiles.SelectedRows[0].Cells[0].Value.ToString());
         //Find the selected row
         var selectedFile = list.First(x => x.Id == selectedId);
         if (selectedFile.FileName != null)
         {
             //View the file
             FileSettings fileSettings = new FileSettings();
             fileSettings.FileName = selectedFile.FileName;
             frmUpdatePdf updatePdf = new frmUpdatePdf(fileSettings, true);
             updatePdf.ShowDialog();
         }
     }
 }