C# - Wait to finish before doing the next task
- by Alex Ogden
i have a server application with a richtextbox as the console text basically. The problem is, i have start, restart and stop buttons - But my restart button doesn't work.
Heres my code for the restart button:
consoletxt("RESTART", "Restarting Server...");
statuslabel1.Text = "Restarting";
statuslabel1.ForeColor = Color.Orange;
statuslabel2.Text = "Restarting";
statuslabel2.ForeColor = Color.Orange;
command("stop");
//The performclick just starts the server
startbtn.PerformClick();
statuslabel1.Text = "Online";
statuslabel1.ForeColor = Color.DarkGreen;
statuslabel2.Text = "Online";
statuslabel2.ForeColor = Color.DarkGreen;
consoletxt("RESTART", "Restart completed, server online!");
However, the output is this:
2012-04-01 11:32:12 [RESTART] Restarting Server...
2012-04-01 11:32:12 [RESTART] Restart completed, server online!
2012-04-01 11:32:12 [INFO] CONSOLE: Stopping the server..
2012-04-01 11:32:12 [INFO] Stopping server
So, it says that the restart has finished in the text - but it hasn't - all it has done is stop the server.
Please can sombody explain to me how to do this properly?
Thanks!