public static void listenProcessesTermination(ProcessStopEvent handler) { processStopHandler = handler; ManagementEventWatcher stopWatch = new ManagementEventWatcher( new WqlEventQuery("SELECT * FROM Win32_ProcessStopTrace")); stopWatch.EventArrived += new EventArrivedEventHandler(stopWatch_EventArrived); stopWatch.Start(); }
private void _stepController_StepReached(object sender, int stepNo) { _stepController.StopStep(); if (_stepCount >= _recipe.Steps.Count) { // done.... ProcessStopEvent?.Invoke(sender, stepNo); } else { var step = _recipe.Steps[_stepCount]; _stepController.StartStep(step); Logger.Log(_logfilePathHeader, $"Auto next step:{step.Name},StepNo:{step.SortOrder},Time:{DateTime.Now}"); _stepCount++; } }