public void WaitUntilGame() { if (GameProcess != null) return; for (var i = 0; i < 100; i++) { GameProcess = TryToGetGameProcess(); if (GameProcess != null) break; Thread.Sleep(500); } }