Epson Perfection scanner V30. Windows 7, enterprise, 32 bit.
I used your simple demo code with some extras to create a form to create a document scanner.
Problem 1.
If I set VintaSoftTwain device.ShowIndicators to true, the Vintasoft progress dialog pops up immediately the scanner begins to scan and it shows the progress correctly.
If I set showindicators to false and set up my own progress event, the event only starts after the scanner has finished scanning.
If I set showindicators to true, set up my own event (as an experiment), the Vintasoft progress pops up immediately during the scan, my own event arrives after the scan finishes.
Problem 2.
When I use the progress event, tracing through my code shows that eventually 100 is received but my visual studio progress bar only visually shows about 40%. (Min = 0, Max = 100) for the progress bar control.
Code: Select all
private void ImageAcquiringProgress(object sender, ImageAcquiringProgressEventArgs e)
{
#region ImageAcquiringProgress
const string fnName = "ImageAcquiringProgress";
try
{
if (!pbProgress.Visible)
{
pbProgress.Visible = true;
pbProgress.BringToFront();
}
e.Cancel = _cancelScan;
pbProgress.Value = e.Progress;
}
catch(Exception err)
{
LogException(fnName, err);
throw;
}
#endregion
}// function
The image takes many seconds to appear in the picture box after acquisition. I expected it to arrive immediately after the call to "pic1.Image = _device.AcquiredImages.Last.GetAsBitmap(true);"
but its not. I put some debug statements around this line and it passed through the line of code in 6ms so that's fine. It's such a long enough period that I know the user of the software will wonder what's going wrong. All the events to say the scan have finished have arrived, the status texts and buttons on my form says it's idle, but Im aware that the messages for clicking buttons are being held up in message queue as I get no animation of my buttons.
Code: Select all
private void DeviceImageAcquired(object sender, ImageAcquiredEventArgs e)
{
#region DeviceImageAcquired
const string fnName = "DeviceImageAcquired";
try
{
if (_device.AcquiredImages.Count > 0)
{
if (pic1.Image != null)
{
pic1.Image.Dispose();
pic1.Image = null;
}
pic1.Image = _device.AcquiredImages.Last.GetAsBitmap(true);
cmdOk.Enabled = true;
}
}
catch(Exception err)
{
LogException(fnName, err);
frmWarning.ShowError(this,err);
}
#endregion
}// function
If this is set up as asynchronous using _device.Acquire() , is the scanning etc being run in its own thread? Because it's not really running asynchronously at the moment. My timer messages stop (I wanted an animation running while the scan was taking place which doesn't work), buttons within my window are unuseable etc.