0
My system has a method that puts each event fired into one thread, save, edit, search, everything goes to one 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 comes to this this.ShowDialog();
, does not fire a shot Exception
, No mistake, nothing, just stop the application on that line and don’t walk anymore. At first I will not post more codes because I do not know which part of the code could help.
It’s Winforms or WPF?
– Tony
Watch out for that misspelled "rustle".
– Bacco
Have you checked your thread is not in infinite loop?
– Oralista de Sistemas
Have you considered using http://msdn.microsoft.com/en-us/library/system.threading.tasks.task(v=vs.110). aspx instead of thread gross?
– Maniero
Opa Bigown, is winform, is a delicate point that code ai pq is found in a form used as inheritance in all other application, and as I caught the tram walking still do not want to make very impact changes(but if there is no other way...) I will check the possibility of loop.
– user8588
Check that the Windows Event Viewer has not registered a entry detailing the exception that occurred. The ideal would be to "envelop" your codes (each delegate, inclusive) with Try/catch to avoid surprise closures of your application.
– Jônatas Hudler