/// <summary> /// /// </summary> /// <param name="stParameters"></param> /// <returns></returns> public bool BtnStartMeasurement(Parameters stParameters) { mParameters = stParameters; Spectrometer.UseAdaptation = stParameters.AutoExposureTime; MSpectraProcessor.SpectraToLoad = stParameters.Average; try { ISpectrometerParse spectrometer = Spectrometer; Spectrometer.MParameters = Spectrometer.Parameters.Parse( periodLength: stParameters.PeriodLength, exposureTime: stParameters.ExposureTime, adaptation: stParameters.AutoExposureTime, spectrometer: ref spectrometer); } catch (ArgumentException ex) { Front.My_msg(ex.Message); return(false); } MSpectraProcessor.MaxDerivativeIndex = null; // Reset. Front.My_msg("Parameters set & measuring"); if (MSpectraProcessor.SpectraToLoad > 1) { float time = Spectrometer.Period * MSpectraProcessor.SpectraToLoad; Front.My_msg(string.Format("Spectrum ready every {0} s.", time)); } timerMeasure.Interval = (int)(Spectrometer.Period * 1000); timerMeasure.Start(); return(true); }
public static Parameters Parse(float periodLength, float exposureTime, bool adaptation, ref ISpectrometerParse spectrometer) { // Spectrometer bounds. if (exposureTime < spectrometer.MinExposureTime) { throw new ArgumentException(string.Format( "Minimal exposure time is {0}.", spectrometer.MinExposureTime)); } if (exposureTime > spectrometer.MaxExposureTime) { throw new ArgumentException(string.Format( "Maximal exposure time is {0}.", spectrometer.MaxExposureTime)); } return(new Parameters(periodLength: periodLength, exposureTime: exposureTime, adaptation: adaptation)); }
public static Parameters Parse(string periodLength, string exposureTime, bool adaptation, ref ISpectrometerParse spectrometer) { throw new NotImplementedException(); }