private void Connect_Click(object sender, EventArgs e) { var selected = (ComboBoxCamera)CameraComboBox.SelectedItem; if (selected != null) { handle = AtikPInvoke.ArtemisConnect(selected.id); if (handle.ToInt32() != 0) { ConnectedLabel.Text = "Connected"; Disconnect.Enabled = true; Connect.Enabled = false; StartExposureButton.Enabled = true; // Using 0 for the sensor checks the number of sensors // rather than checking for a temperature int num = 0; AtikPInvoke.ArtemisTemperatureSensorInfo(handle, 0, ref num); if (num != 0) { StartCoolingButton.Enabled = true; checkTemperature = true; } else { Temperature.Text = "No Cooling"; } } if (AtikPInvoke.ArtemisHasCameraSpecificOption(handle, (ushort)AtikCameraSpecificOptions.ID_GOCustomGain) && AtikPInvoke.ArtemisHasCameraSpecificOption(handle, (ushort)AtikCameraSpecificOptions.ID_GOCustomOffset) && AtikPInvoke.ArtemisHasCameraSpecificOption(handle, (ushort)AtikCameraSpecificOptions.ID_PadData) && AtikPInvoke.ArtemisHasCameraSpecificOption(handle, (ushort)AtikCameraSpecificOptions.ID_EvenIllumination)) { CMOSOptionsBox.Visible = true; int length = 0; byte[] go = new byte[2]; AtikPInvoke.ArtemisCameraSpecificOptionGetData(handle, (ushort)AtikCameraSpecificOptions.ID_GOPresetMode, go, 2, ref length); GOModeComboBox.SelectedIndex = go[0]; if (go[0] == 0) { GainBox.Visible = true; byte[] gain = new byte[6]; AtikPInvoke.ArtemisCameraSpecificOptionGetData(handle, (ushort)AtikCameraSpecificOptions.ID_GOCustomGain, gain, 6, ref length); var gainMax = (gain[3] << 8) + gain[2]; var gainVal = (gain[5] << 8) + gain[4]; GainUpDown.Minimum = 0; GainUpDown.Maximum = gainMax; GainUpDown.Value = gainVal; OffsetBox.Visible = true; byte[] offset = new byte[6]; AtikPInvoke.ArtemisCameraSpecificOptionGetData(handle, (ushort)AtikCameraSpecificOptions.ID_GOCustomOffset, offset, 6, ref length); var offsetMax = (offset[3] << 8) + offset[2]; var offsetVal = (offset[5] << 8) + offset[4]; OffsetUpDown.Minimum = 0; OffsetUpDown.Maximum = offsetMax; OffsetUpDown.Value = offsetVal; } byte[] padData = new byte[1]; AtikPInvoke.ArtemisCameraSpecificOptionGetData(handle, (ushort)AtikCameraSpecificOptions.ID_PadData, padData, 1, ref length); PadDataCheckBox.Checked = Convert.ToBoolean(padData[0]); byte[] evenIllu = new byte[1]; AtikPInvoke.ArtemisCameraSpecificOptionGetData(handle, (ushort)AtikCameraSpecificOptions.ID_EvenIllumination, evenIllu, 1, ref length); EvenIlluminationCheckBox.Checked = Convert.ToBoolean(evenIllu[0]); } if (AtikPInvoke.ArtemisHasFastMode(handle)) { int length = 0; FastModeBox.Visible = true; byte[] expSpeed = new byte[2]; AtikPInvoke.ArtemisCameraSpecificOptionGetData(handle, (ushort)AtikCameraSpecificOptions.ID_ExposureSpeed, expSpeed, 2, ref length); ExposureSpeedBox.SelectedIndex = expSpeed[0]; byte[] bitSend = new byte[2]; AtikPInvoke.ArtemisCameraSpecificOptionGetData(handle, (ushort)AtikCameraSpecificOptions.ID_BitSendMode, bitSend, 2, ref length); BitSendModeBox.SelectedIndex = bitSend[0]; AtikPInvoke.ArtemisSetFastCallback(handle, fastCallback); fastMode = true; Thread fastModeReceive = new Thread(DisplayFastModeImages); fastModeReceive.Start(); } } }