private void button1_Click(object sender, EventArgs e) { if (dgvEscanear.RowCount <= 0) { MessageBox.Show("Debe de agregar al menos una guia"); return; } lblMensaje.Visible = false; DialogResult escanearD; //escanearD = MessageBox.Show("Para continuar asegurese que las hojas esten colocadas en el escaner, " + // "y corresponden a los número de guia marcados " + // ", Para proceder a digitalizar presione aceptar.", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); escanearD = DialogResult.OK; if (escanearD == DialogResult.OK) { dgvEscanear.Enabled = false; btnAsosiar.Enabled = false; string directorio = ConfigurationManager.AppSettings["dirOUT"].ToString(); Twain.Principal tw = new Twain.Principal(); string dir = directorio; string PLnombre; try { string opc = tw.SelectScaner(); if (opc == "Success") { PLnombre = PLautomatico(); _PL = PLnombre; if (PLnombre == "0") { MessageBox.Show("Error al intentar crear el PL automatico"); return; } tw.ScanPDF(PLnombre, directorio); //por si se buelve a cambiar // btnAsosiar.Enabled = true; btnAsosiar_Click(0, e); } } catch (Exception) { } } }
bool Digitalizar() { bool resultado = true; dgvEscanear.Enabled = false; btnAsosiar.Enabled = false; string directorio = ConfigurationManager.AppSettings["dirOUT"].ToString(); Twain.Principal tw = new Twain.Principal(); string dir = directorio; string PLnombre; try { string opc = tw.SelectScaner(); if (opc == "Success") { PLnombre = PLautomatico(); _PL = PLnombre; if (PLnombre == "0") { MessageBox.Show("Error al intentar crear el PL automatico"); return(false); } tw.ScanPDF(PLnombre, directorio); btnAsosiar.Enabled = true; } else { if (_Nid_sku != "") { this.Close(); return(false); } } } catch (Exception) { } return(resultado); }
private void button2_Click(object sender, EventArgs e) { // DialogResult escanearD; escanearD = MessageBox.Show("Para continuar asegurese que las hojas estan colocadas en el escaner, " + "y corresponden a los número de guia marcados " + ", Para proceder a escanear presione aceptar.", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (escanearD == DialogResult.OK) { string directorio = @"C:\prueba\pdf\"; //ConfigurationManager.AppSettings["dirOUT"].ToString(); Twain.Principal tw = new Twain.Principal(); string dir = directorio; string opc = tw.SelectScaner(); if (opc == "Success") { tw.ScanPDF("prueba", directorio); } btnAsosiar.Enabled = true; } }