GUI and Threading
- by cam
Isn't there a better way to handle GUI (WinForms) from another thread than creating a delegate for every single method I need to use? It seems like there would be a better way.
Here's the current code I use for every single GUI method:
private delegate void SetStatusTextDelegate(string set_text);
public void SetStatusText(string set_text)
{
if (status_prog.InvokeRequired)
{
status_prog.Invoke(new SetStatusTextDelegate(SetStatusText), set_text);
}
else
{
status_prog.Text = set_text;
}
}