private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { //encerra o progress this.xFrmProgressBoleto.Dispose(); if (this.boletoValidado) { // Cria um formulário com um componente WebBrowser this.xFrmBoletoView.ShowBoleto(pathLayout); this.xFrmBoletoView.ShowDialog(); foreach (var bb in banco.BoletosBancario) { BoletoUtil.ShowBoletoHtml(bb); } } } catch (Exception ex) { MessageBox.Show(ex.Message); return; } }
private void gerarBoletosBancario(AbstractBank banco) { this.banco = banco; try { decimal valorBoleto = ParseUtil.ToDecimal(txtValorBoleto.Text); string nossoNumero = txtNossoNumero.Text; string numeroDocumento = txtNumeroDocumento.Text; string instrucoes = memoInstrucoes.Text.ToUpper(); DateTime vencimento = dtEditVencimento.DateTime; var cedente = getCedente(); var sacado = getSacado(); int qtde = ParseUtil.ToInt(spinEditQuantidade.Value); //cria os boletos banco.CreateBoletos(qtde, vencimento, valorBoleto, nossoNumero, numeroDocumento, cedente, sacado, instrucoes); //criar o layout do boleto pathLayout = BoletoUtil.GenerateTicketLayout(banco.BoletosBancario); this.boletoValidado = true; //BoletoUtil.ShowBoletoPDF(banco.BoletosBancario[0]); } catch (Exception ex) { this.boletoValidado = false; this.backgroundWorker.CancelAsync(); Console.WriteLine(ex); } }
private void backstageTabSave_SelectedChanged(object sender, DevExpress.XtraBars.Ribbon.BackstageViewItemEventArgs e) { var op = saveFileDialog.ShowDialog(); if (op == DialogResult.OK) { var path = saveFileDialog.FileName; var bmp = BoletoUtil.CreateImage(webBrowser.Url.ToString()); bmp.Save(path); } }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) { var op = saveFileDialog.ShowDialog(); if (op == DialogResult.OK) { var path = saveFileDialog.FileName; var bmp = BoletoUtil.CreateImage(webBrowser.Url.ToString()); bmp.Save(path); } //retorna o path da imagem //BoletoUtil.GenerateImage(webBrowser.Url.ToString()); }