public void SignOn(string name, Callback Receive, Interact visuals) { // Add the Collegue to the delegate chain Respond += Receive; new Thread((ParameterizedThreadStart) delegate(object o) { visuals.InputEvent += Send; Application.Run(visuals); }).Start(this); // Wait to load the GUI while (visuals == null || !visuals.IsHandleCreated) { Application.DoEvents(); Thread.Sleep(100); } }
public Colleague(Mediator mediator, string name) { this.name = name; visuals = new Interact(name); mediator.SignOn(name, Receive, visuals); }