public void WinFormsMethods_AreDispatchedCorrectly() { this.form = null; ManualResetEventSlim ready = new ManualResetEventSlim(false); Thread windowThread = new Thread(() => { this.form = new DispatchWinFormsObject(ready); FormsApplication.Run(this.form); }); windowThread.SetApartmentState(ApartmentState.STA); windowThread.Start(); ready.Wait(); this.form.AddControl(); this.form.Invoke(new Action(this.form.Close)); windowThread.Join(); }
public void WinFormsMethods_AreDispatchedCorrectly() { this.form = null; ManualResetEventSlim ready = new ManualResetEventSlim(false); Thread windowThread = new Thread(() => { this.form = new DispatchWinFormsObject(ready); FormsApplication.Run(this.form); }); windowThread.SetApartmentState(ApartmentState.STA); windowThread.Start(); ready.Wait(); this.form.AddControl(); this.form.Invoke(new Action(this.form.Close)); windowThread.Join(); }