How to show and update popup in 1 thread
- by user3713986
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.