Puh. Also so habe ich es jetzt und so geht es auch:
Code:
private delegate void ThreadFinishEventHandler(object Sender);
private event ThreadFinishEventHandler OnThreadFinishHandler;
private void OnThreadFinish()
{
if (OnThreadFinishHandler != null)
OnThreadFinishHandler(this);
}
private void ThreadFinish(object Sender)
{
SetStatusText(resManager.GetString("ThreadStatusFinish"));
}
private void ThreadProc()
{
try
{
for (int i = 0; i < 100000; i++)
{
Invoke(new MethodInvoker(thread_Event));
Thread.Sleep(0);
}
this.OnThreadFinishHandler += ThreadFinish;
}
finally
{
SetStatusTextDelegate sd = SetStatusText;
Invoke(sd, resManager.GetString("ThreadStatusFinish"));
}
}
Man war das eine schwere Geburt. Besten Dank noch mal an alle, die so viel Geduld hatten.