Rais an event in the child form:
public partial class Form1 : Form
{
public event EventHandler OkayToProceedChanged;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
EventHandler eh = OkayToProceedChanged;
if(eh != null)
{
eh(this, new EventArgs());
}
}
}
And subscribe to that event in the main program:
private bool _okayToProceed = false;
public void Main()
{
Debug.Print("This is main ");
Form1 frm = new Form1();
frm.OkayToProceedChanged += new EventHandler(Form1_OkayToProceedChanged);
frm.Show();
while(!_okayToProceed)
{
System.Threading.Thread.Sleep(10);
}
Debug.Print("We are on the end of programe ");
public SldWorks swApp;
}
private void Form1_OkayToProceedChanged(object sender, EventArgs e)
{
_okayToProceed = true;
}