Вопрос

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