void TestMdi2() { TortureMdiContainer container = new TortureMdiContainer(); Timer timer = new Timer(); Console.Write("mdi test 2:"); TortureMdiChild child = new TortureMdiChild(); Button b = new Button(); b.Text = "Click me if you see me"; b.Click += delegate(object sender, EventArgs e) { Console.WriteLine("PASS"); timer.Stop(); container.Close(); }; b.Dock = DockStyle.Fill; child.ClientSize = new Size(100, 50); child.Controls.Add(b); child.Show(); child.MdiParent = container; child.Show(); timer.Interval = 5000; timer.Tick += delegate(object sender, EventArgs e) { Console.WriteLine("FAIL (timer)"); timer.Stop(); container.Close(); }; timer.Start(); container.ShowDialog(this); }
void TestToplevel2 () { Timer timer = new Timer (); Console.Write ("toplevel test 2:"); TortureMdiChild child = new TortureMdiChild (); Button b = new Button (); b.Text = "Click me if you see me"; b.Click += delegate (object sender, EventArgs e) { Console.WriteLine ("PASS"); timer.Stop (); child.Close(); }; b.Dock = DockStyle.Fill; child.ClientSize = new Size (100, 50); child.Controls.Add (b); timer.Interval = 5000; timer.Tick += delegate (object sender, EventArgs e) { Console.WriteLine ("FAIL (timer)"); timer.Stop (); child.Close(); }; timer.Start (); child.ShowDialog (this); }