I am writing a method in C# that obtains every Identity object in the Sources property and then determines for each Identity whether it supports Duplex. However, I am getting an InvalidCastException. The scanner is a Fujitsu fi-5120C. Can someone please help? Thanks.
_Twain is an instance of TwainControl.
private bool DetermineIfDeviceSupportsDuplex(Identity idnt)
{
try
{
_Twain.CurrentSource = idnt;
Duplexes duplex = _Twain.Duplex; // I get an InvalidCastException here
if (duplex != Duplexes.None)
{
return true;
}
else
{
return false;
}
}
finally
{
_Twain.CloseSource();
_Twain.CurrentSource = null;
}
return false;
}