private void OnDevicePreflightSync(PreflightEventArgs args) { try { Property.Preflight preflight = new Property.Preflight(args.RunContext); // These values are taken from the script Nullable <double> temperatureMin = preflight.GetCurrentValue(m_Properties.TemperatureMin); Nullable <double> temperatureMax = preflight.GetCurrentValue(m_Properties.TemperatureMax); if (temperatureMin == null) { throw new InvalidOperationException(m_Properties.TemperatureMin.Name + " is not set"); } if (temperatureMax == null) { throw new InvalidOperationException(m_Properties.TemperatureMax.Name + " is not set"); } if (temperatureMin > temperatureMax) { throw new InvalidOperationException("Invalid temperature limits: " + m_Properties.TemperatureMin.Name + " " + temperatureMin.ToString() + " > " + m_Properties.TemperatureMax.Name + " " + temperatureMax.ToString()); } } catch (Exception ex) { AuditMessage(AuditLevel.Error, ex.Message); } }
private void OnDevicePreflightSync(PreflightEventArgs args) { try { Log.WriteLine(Id, "ProgramTime.Minutes = " + args.RunContext.ProgramTime.Minutes.ToString()); Property.Preflight preflight = new Property.Preflight(args.RunContext); Nullable <double> pressureLimitMin = preflight.GetCurrentValue(m_Properties.PressureLowerLimit); Nullable <double> pressureLimitMax = preflight.GetCurrentValue(m_Properties.PressureUpperLimit); if (pressureLimitMin == null) { throw new InvalidOperationException(m_Properties.PressureLowerLimit.Name + " is not set"); } if (pressureLimitMax == null) { throw new InvalidOperationException(m_Properties.PressureUpperLimit.Name + " is not set"); } if (pressureLimitMin > pressureLimitMax) { throw new InvalidOperationException("Invalid pressure limits: " + m_Properties.PressureLowerLimit.Name + " " + pressureLimitMin.ToString() + " > " + m_Properties.PressureUpperLimit.Name + " " + pressureLimitMax.ToString()); } } catch (Exception ex) { AuditMessage(AuditLevel.Error, ex.Message); } }