Thanks, Chad. Here is full code sufficient to demonstrate the problem on my machine. I am using Windows 10 64 bit professional. The problem occurs regardless of whether I build 64 bit, 32 bit, or Any CPU.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ASCOM.DriverAccess;
namespace WindowsFormsApp3
{
public partial class Form1 : Form
{
Camera MyCamera;
bool exposing = false;
bool CameraOk = false;
public Form1()
{
InitializeComponent();
}
private void ConnectFastGuideCamera()
{
MyCamera = new Camera("ASCOM.ASICamera2.Camera");
try
{
MyCamera.Connected = true;
MyCamera.FastReadout = true;
CameraOk = true;
}
catch (System.Exception)
{
MessageBox.Show("Camera not connected");
}
if (CameraOk)
{
timer1.Interval = 50;
timer1.Enabled = true;
}
}
private void connectButton_Click(object sender, EventArgs e)
{
ConnectFastGuideCamera();
connectButton.BackColor = CameraOk ? Color.Yellow : Color.Red; // Show we have successfully connected
}
private void exposeButton_Click(object sender, EventArgs e)
{
if (!CameraOk)
{
MessageBox.Show("No camera");
}
else if (exposing)
{
MessageBox.Show("Already exposing");
}
else
{
MyCamera.BinX = 2;
MyCamera.BinY = 2;
MyCamera.StartExposure(0.1, true); // This fails if binning = 2, succeeds if binning = 1
exposing = true;
exposeButton.BackColor = Color.Yellow; // Show we have started the exposure
}
}
private void timer1_Tick(object sender, EventArgs e)
{
// See if an exposure has begun but is now complete
if (exposing && MyCamera.ImageReady)
{
exposeButton.BackColor = Color.Blue; // Show the exposure has completed
exposing = false;
}
}
}
}