void Start() { Stop(); if (Count == 0) { throw (new Exception("No device found")); } FThread.PerformBlocking(() => { FDevice.OpenDevice(FDeviceID); FSpecification.Width = FDevice.GetParamInt(PRM.WIDTH); FSpecification.Height = FDevice.GetParamInt(PRM.HEIGHT); FSpecification.Name = FDevice.GetParamString(PRM.DEVICE_NAME); FSpecification.Type = FDevice.GetParamString(PRM.DEVICE_TYPE); FSpecification.Serial = FDevice.GetParamString(PRM.DEVICE_SN); if (FTrigger == null) { FDevice.SetParam(PRM.TRG_SOURCE, TRG_SOURCE.OFF); } else { switch (FTrigger.GetTriggerType()) { case TriggerType.Software: FDevice.SetParam(PRM.TRG_SOURCE, TRG_SOURCE.SOFTWARE); break; case TriggerType.GPI: HardwareTrigger hardwareTrigger = FTrigger as HardwareTrigger; if (hardwareTrigger == null) { throw (new Exception("Hardware trigger not properly initialised")); } FDevice.SetParam(PRM.GPI_SELECTOR, 1); FDevice.SetParam(PRM.GPI_MODE, GPI_MODE.TRIGGER); switch (hardwareTrigger.Source) { case HardwareTrigger.HardwareEvent.RisingEdge: FDevice.SetParam(PRM.TRG_SOURCE, TRG_SOURCE.EDGE_RISING); break; case HardwareTrigger.HardwareEvent.FallingEdge: FDevice.SetParam(PRM.TRG_SOURCE, TRG_SOURCE.EDGE_FALLING); break; case HardwareTrigger.HardwareEvent.WhilstHigh: throw(new Exception("WhilstHigh is not implemented")); } break; default: throw (new Exception("Trigger type not handled")); } } FDevice.StartAcquisition(); FRunning = true; }); }