G
Guest
Hi all,
I have a workerthread which notyfies the GUI through a delegate like this:
if (deviceInsertedDelegate) deviceInsertedDelegate(stringAddress);
Now in my Form's code I write code like this:
private delegate void DeviceInsertedCallback(string Address);
public void DeviceInserted(string Address)
{
if (this.label1.InvokeRequired)
{
Invoke(new DeviceInsertedCallback(DeviceInserted), new
object[] { Address });
}
else
{
label1.Text = "Login : " + Address;
}
}
Now my question is if it's possible not to have the code as above in my
form. Would it be possible to synchronize (or whatever) from within my
worker thread.
Thanks in advance,
Bart
I have a workerthread which notyfies the GUI through a delegate like this:
if (deviceInsertedDelegate) deviceInsertedDelegate(stringAddress);
Now in my Form's code I write code like this:
private delegate void DeviceInsertedCallback(string Address);
public void DeviceInserted(string Address)
{
if (this.label1.InvokeRequired)
{
Invoke(new DeviceInsertedCallback(DeviceInserted), new
object[] { Address });
}
else
{
label1.Text = "Login : " + Address;
}
}
Now my question is if it's possible not to have the code as above in my
form. Would it be possible to synchronize (or whatever) from within my
worker thread.
Thanks in advance,
Bart