Hola a todos, ya expuse en un anterior post miproblemática. Octavio me
remitió a un artículo del El Guille.
El caso tengo unmétodo Callback (evento) de una clase que utiliza hilos
internamente.
private void DownloadProgressCallback ( int bytesSoFar, int totalBytes )
{
try
{
this.bytesDownloadedTextBox.Text =
bytesSoFar.ToString("#,##0"); // Problema de subprocesos
}
catch (Exception ex)
{
Console.WriteLine("Error DownloadProgressCallback " +
ex.Message);
}
}
Sustituyo la asignación del Textbox con la indicación del Guille, similar a
esto:
delegate void SetTextCallback(string text);
private void SetText(string text)
{
// InvokeRequired required compares the thread ID of the
// calling thread to the thread ID of the creating thread.
// If these threads are different, it returns true.
if( textBox1.InvokeRequired )
{
SetTextCallback d = new SetTextCallback(SetText);
this.Invoke(d, new object[] { text });
}
else
{
this.textBox1.Text = text;
}
}
El caso que en la ejecución (con F5 desde VS2005), al llegar a ese punto se
queda como bloqueado y ahí se queda, no parece ejecutar nada más, y tengo que
parar la ejecución.
Algo se me ha pasado por alto ???
Saludos.
http://www.alhambra-eidos.com/web2005/index.html
Leer las respuestas