Tattakashi123 / t

Automatically exported from code.google.com/p/twaindotnet
0 stars 0 forks source link

return TwainResult from Twain.SelectSource method #61

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello

Thank you for sharing twain wrapper.

I'm using Twain.SelectSource() method to allow user select twain source before 
scanning will be started.
The problem is that if user presses Cancel it is not possible to catch it in 
the program and twain scan dialog is displayed. Please find sample code that 
I'm using below:

_twain.SelectSource();
_twain.StartScanning(_settings);

I would like to propose to modify SelectSource method and add return result to 
it. To make it possible to check in the program - was twain source selected by 
user or not.

if (_twain.SelectSource() != TwainResult.Success)
    Trace.WriteLine("user twain source failed");

I've thought to throw an special exception from DataSource.UserSelected method 
if result is not Success but this will break existing code. So I've modified 
Twain.SelectSource method. Please check patch attached and apply if it is 
suitable.

Regards

Original issue reported on code.google.com by oleksa.b...@gmail.com on 15 May 2013 at 1:57

Attachments: