saraff-9EB1047A4BEB4cef8506B29BA325BD5A / Saraff.Twain.NET

Saraff.Twain.NET is the skillful scanning component which allows you to control work of flatbed scanner, web and digital camera and any other TWAIN device from .NET environment. You can use this library in your programs written in any programming languages compatible with .NET technology.
GNU General Public License v3.0
102 stars 35 forks source link

Issue after scan #102

Closed ZecaAdegas closed 1 year ago

ZecaAdegas commented 1 year ago

Hello!

I am having an issue where I want to stay in the "menu" after a scan, where the program immediatly closes, even if I have a loop reading key press waiting for a specific key to exit. I want to have this behaviour, instead of exiting after 1 scan or 5. Is there a way to stop this automatic closing of the program?

Example

Also, is there a way to know specifically when the scanner has started scanning? I currently only know when it has started and ended.

Thank you!

saraff-9EB1047A4BEB4cef8506B29BA325BD5A commented 1 year ago

Hello, @ZecaAdegas About "to stay in the menu", it possible. Invoke the Twain.Acquire() method in loop. For more information see:

About " way to know specifically when the scanner has started scanning", it possible, see:

ZecaAdegas commented 1 year ago

As for the first issue, I read about the states of TWAIN. In order to not immediately close the console app, closing the source after a scan and opening again could fix the exit of the app?

As for the second issue, I could not understand how the links would apply to this scenario.

Thank you for your patience!

saraff-9EB1047A4BEB4cef8506B29BA325BD5A commented 1 year ago

Hello, @ZecaAdegas About "closing the source after a scan", yes, it could fix.

About "way to know specifically when the scanner has started scanning", in buffered memory mode transfer for each image is raised SetupMemXferEvent event before obtaining, and is raised MemXferEvent event during receiving. After completion of scanning is raised AcquireCompleted event.

ZecaAdegas commented 1 year ago

Ahhh okay, thank you for explaining!

I can only test this out on monday so can't test right now but you can close the issue, with this help I think I can resolve these problems!

ZecaAdegas commented 1 year ago

Hello!

I have now tried both suggestions to the problems and both have not worked. Closing the data source does not prevent the exit of the console app after one scan (if called in loop closes after the number of scans intended), and both the SetupMemXferEvent and MemXferEvent have not worked (I want to print to the console something like "Started scanning").

Do you have any further suggestions?

saraff-9EB1047A4BEB4cef8506B29BA325BD5A commented 1 year ago

Hello, @ZecaAdegas Try see Saraff.Twain.NET CS Samples

Are you set the XferMech capability to TwSX.Memory?

ZecaAdegas commented 1 year ago

Hello @saraff-9EB1047A4BEB4cef8506B29BA325BD5A !

I am following the Sample 3. In this sample the program always exits after one scan, which is the same behaviour that I have (but I have a loop for the menu that is not working).

As for the XferMech capability, setting this makes it so that I cannot save the scan to a location (desktop such as your example), and with using the MemXferEvent or SetupMemXferEvent, both only print out after the scan has finished.

saraff-9EB1047A4BEB4cef8506B29BA325BD5A commented 1 year ago

Hello, @ZecaAdegas Try see the Sample 2. It had the loop and the XferMech samples.