/// <summary> /// Used to start the match. /// IClients are expected to handle everything from here. /// </summary> public void ExecuteMatch() { PlayerOne?.SetHost(true); PlayerTwo?.SetHost(false); // Launch StarCraft II clients and connect PlayerOne?.Initialize(); PlayerTwo?.Initialize(); // Let the host create the game PlayerOne?.CreateGame(); // Let both run and play (asynchronous) var p1 = Task.Run(() => PlayerOne?.JoinGame()); var p2 = Task.Run(() => PlayerTwo?.JoinGame()); // Prevent main-thread from closing the application prematurely. Task.WaitAll(p1, p2); }