문제

I made a launcher for my game and successfully found the code to launch the game. But for some reason it doesn't work. The error message is InvalidOperationException

Is there an easier way to do this? Or how can I fix this?

This is the code:

private void Startgame_Click(object sender, EventArgs e)
{
   using (Zombie_Shooter.GameCode game = new Zombie_Shooter.GameCode())
   {
       game.Run();
   }
}
도움이 되었습니까?

해결책

Do you can try this ?

Thread thread = new Thread(() =>
{    
     Game1 game = new Game();    
     game.Run();
});


private void Startgame_Click(object sender, EventArgs e)
{
   thread.Start();
   thread.Join();
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top