public static bool RestartSkeetEstimator() { Stopwatch sw = new Stopwatch(); isSceneEstimatorRunning = true; comm.SendMessage(new StopPublishMessage(SceneEstimatorMachineName, SceneEstimatorPublishName)); sw.Start(); while (isSceneEstimatorRunning == true && sw.Elapsed < TimeSpan.FromSeconds(5)) { Thread.Sleep(1); } if (sw.Elapsed > TimeSpan.FromSeconds(5)) { Console.WriteLine("Timed out waiting for Scene Estimator to stop!"); } sw.Stop(); sw.Reset(); comm.SendMessage(new StartPublishMessage(SceneEstimatorMachineName, SceneEstimatorPublishName)); sw.Start(); while (isSceneEstimatorRunning == false && sw.Elapsed < TimeSpan.FromSeconds(5)) { Thread.Sleep(1); } if (sw.Elapsed > TimeSpan.FromSeconds(5)) { Console.WriteLine("Timed out waiting for Scene Estimator to start!"); return(false); } Console.WriteLine("Succesfully Restarted Scene Estimator"); return(true); }
public static void KillApp() { traceText.Flush(); try { if (curPublish != null) { curPublish.Stop(); } } catch (Exception ex) { if (curPublish != null) { comm.SendMessage <StartStopPublishMessageReply>(new StartStopPublishMessageReply(WatchdogComm.GetMachineName(), curPublish.name, false, "Exception Stopping Publish" + ex.Message)); } Trace.WriteLine("Exception Stopping! " + ex.Message); } running = false; Thread.Sleep(3000); traceText.Flush(); //Process.GetCurrentProcess().Kill(); }
void StopPublish(string machineName, string publishName) { comm.SendMessage(new StopPublishMessage(machineName, publishName)); }