private void ListenToProcess() { WriteToConsole("Serverlistener thread is running..."); while (true) { if (IsServerRunning()) { //WriteToConsole("Server is running..."); } else { if (ConfigHolder.autorestart) { WriteToConsole("Process not found, restarting server..."); Logger.WriteToLogFile("Process not running, trying to restart server..."); ServerLauncher.StartServer(); } } Application.Current.Dispatcher.BeginInvoke(new Action(() => { window.SetServerIsRunning(IsServerRunning()); })); Thread.Sleep(7000); } }
public void StartServer() { window.WriteToConsole("Starting server..."); window.UpdateStatusLabel(); ServerLauncher.StartServer(); }
void OnRestartBtnClick(object sender, RoutedEventArgs e) { ServerProcessListener.KillProcess(); Logger.WriteToLogFile("Restarted server with server tool"); ServerLauncher.StartServer(); }