private void btnGerarLote_Click(object sender, EventArgs e)
{
Cursor = Cursors.AppStarting; ;
btnGerarLote.Enabled = false;
openFileDialog1.InitialDirectory = Application.StartupPath + "\\nfe\\arquivos\\assinado";
openFileDialog1.Filter = "NF-e (*.xml)|";
openFileDialog1.Title = "Localizar NF-e";
string retStatus = "Falha na geração de lote.";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
lblStatus.Text = "Gerando Lote de arquivo, aguarde...";
Random r = new Random(5);
txtLoteID.Text = Convert.ToString((r.Next() + DateTime.Now.Millisecond));
nfec.nfecsharp nfe = new nfec.nfecsharp();
retStatus = nfe.GerarLote(openFileDialog1.FileName, Convert.ToInt32(txtLoteID.Text));
}
btnGerarLote.Enabled = true;
Cursor = Cursors.Default;
lblStatus.Text =retStatus;
}