/// <summary> /// Starts an application. /// </summary> /// <param name="context">The application to start.</param> private void StartApplication(object context) { ApplicationProcess application = (ApplicationProcess)context; bool retry = true; while (retry) { lock (this.locker) { if (this.IsRunning && this.applications.IndexOf(application) >= 0 && !application.IsRunning) { retry = !application.Start(); } else { retry = false; } } } }
public void ApplicationProcessStopForce() { string path = ApplicationUtils.CreateValidExampleApplication(); ManualResetEvent handle = new ManualResetEvent(false); try { using (ApplicationProcess process = new ApplicationProcess(Logger, path, Path.GetFullPath("Collar.exe"))) { process.Exited += (object sender, EventArgs e) => { Assert.Fail(); handle.Set(); }; process.KillTimeout += (object sender, EventArgs e) => { Assert.Fail(); handle.Set(); }; Assert.IsTrue(process.Start()); process.Stop(true); WaitHandle.WaitAll(new WaitHandle[] { handle }, 11000); } } finally { handle.Close(); } }
public void ApplicationProcessStart() { string path = ApplicationUtils.CreateValidExampleApplication(); using (ApplicationProcess process = new ApplicationProcess(Logger, path, Path.GetFullPath("Collar.exe"))) { Assert.IsTrue(process.Start()); } }