How to show and update popup in 1 thread
Posted
by
user3713986
on Stack Overflow
See other posts from Stack Overflow
or by user3713986
Published on 2014-06-06T07:28:13Z
Indexed on
2014/06/07
9:25 UTC
Read the original article
Hit count: 136
multithreading
I have 1 app. 2 Forms are MainFrm and PopupFrm, 1 thread to update some information to PopupFrm
Now to update PopupFrm i use:
In MainFrm.cs
private PopupFrm mypop;
MainFrm()
{
....
PopupFrm mypop= new PopupFrm();
mypop.Show();
}
MyThread()
{
Process GetData();...
mypop.Update();
...
}
In PopupFrm.cs
public void Update()
{
this.Invoke((MethodInvoker)delegate
....
});
}
Problem here that mypopup alway display when MainFrm display (Start application not when has data to update). So i change MainFrm.cs to :
private PopupFrm mypop;
private bool firstdisplay=false;
MainFrm()
{
....
PopupFrm mypop= new PopupFrm();
//mypop.Show();
}
MyThread()
{
Process GetData();...
if(!firstdisplay)
{
mypop.Show();
firstdisplay=true;
}
mypop.Update();
...
}
But it can not update Popup GUI. So how can i fix this issue ?
Thanks all.
© Stack Overflow or respective owner