Code: Select all
_twain.SourceIndex = TwainHelper.FindSourceIndex(_twain, options.dataSource);
_twain.OpenDataSource();
if (_twain.FeederPresent)
{
if (options.autoFeed)
{
if (_twain.XferCount != -1)
_twain.XferCount = -1;
if (!_twain.FeederEnabled)
_twain.FeederEnabled = true;
if (_twain.AutoFeed != options.autoFeed)
_twain.AutoFeed = options.autoFeed;
}
else
{
if (_twain.XferCount != 1)
_twain.XferCount = 1;
if (_twain.AutoFeed != options.autoFeed)
_twain.AutoFeed = false;
}
}
_twain.ShowUI = true;
_twain.DisableAfterAcquire = false;
while (_twain.AcquireModal()) ;
twainScanFinished(null, null);
}
finally
{
_twain.CloseDataSource();
}