rakijah / CSGSI

A simple C# library to interface with Counter-Strike: Global Offensive's Game State Integration
Other
129 stars 27 forks source link

c# form problem FIX #13

Closed ghost closed 6 years ago

ghost commented 7 years ago

If you have something strange thread error, just edit your code like this: Your Code: void OnNewGameState(GameState gs) { //Your Code is inside the comments if( checkbomb() )startbomb(); //end of codes } Fixed code: void OnNewGameState(GameState gs) { Invoke(new Action(() => { //Your Code is inside the comments if( checkbomb() )startbomb(); //end of codes })); }

So just copy all your "OnGameStateUpdate" codes to the block: Invoke(new Action(() => { //code here }));

ghost commented 7 years ago

PS: because of app will still running after from closed, and this method will also create an error message:

bind Environment.Exit(0) to Form1's FormClosing event