public void StartExposure(double Duration, bool Light)
{
if ((Duration < ExposureMin) || (Duration > ExposureMax)) throw new ASCOM.InvalidValueException("StartExposure: Invalid Duration");
//Set LastExposureDuration;
m_LastExposureDuration = Duration;
//Set LasExposureStartTime;
m_LastExposureStartTime = System.DateTime.Now.ToString("yyyy-MM-ddThh:mm:ss");
//Read & set gain and offset parameters
m_Gain = short.Parse(settings_form.GainTextBox.Text);
m_Offset = short.Parse(settings_form.OffsetTextBox.Text);
//Set camera settings, if fail - exception
if (CameraSetGain(m_Gain) == false) throw new ASCOM.InvalidOperationException("Cant set gain to cam8");
if (CameraSetOffset(m_Offset) == false) throw new ASCOM.InvalidOperationException("Cant set offset to cam8");
//save gain, offset settings
iniSettings iniSet = new iniSettings();
iniSet.gain = m_Gain;
iniSet.offset = m_Offset;
using (Stream writer = new FileStream("cam8s_v05.xml", FileMode.Create))
{
XmlSerializer serializer = new XmlSerializer(typeof(iniSettings));
serializer.Serialize(writer, iniSet);
}
//Call function from cam8sll5.dll to start exposure
CameraStartExposure((int)m_BinX, m_StartX, m_StartY, m_NumX, m_NumY, Duration, Light);
return;
}
//Camera stop exposure