C# Updating GUI from different thread
void MyEventHandler(object sender, EventArgs e)
{
if (this.InvokeRequired)
{
this.Invoke(new EventHandler(MyEventHandler), new object[] { sender, e }
);
}else{
//update GUI here
}
}
void MyEventHandler(object sender, MyEventArgs e)
{
if (this.InvokeRequired)
{
this.BeginInvoke(new EventHandler<MyEventArgs>(MyEventHandler), new object[] { sender, e });
}
else
{
//update GUI here
}
}
Comments
Post a Comment