My system has a method that puts each triggered event into a thread , save, edit, search, everything goes to a thread .
backgroundWorker.DoWork += acaoProcessamento;
backgroundWorker.RunWorkerCompleted += (s, a) =>
{
this.ocooreuErro = a.Error != null;
if ((a.Cancelled == true))
this.lblDescricao.Text = "Cancelado!";
this.Refresh();
this.Close();
};
backgroundWorker.RunWorkerCompleted += acaoConcluir;
backgroundWorker.ProgressChanged += (s, a) =>
{
prbProgresso.Value = Math.Min(100, a.ProgressPercentage);
prbProgresso.Style = prbProgresso.Value == 100
? ProgressBarStyle.Marquee
: ProgressBarStyle.Continuous;
prbProgresso.Visible = prbProgresso.Value > 0;
if (a.UserState != null)
lblDescricao.Text = a.UserState.ToString();
};
backgroundWorker.ReportProgress(0);
backgroundWorker.RunWorkerAsync();
this.ShowDialog();
But a specific routine when it arrives at this this.ShowDialog();
, does not fire any Exception
, does not give error, nothing, just stops the application in that line and does not walk anymore. At first I will not post any more codes because I do not know which part of the code could help.