soukoku / ntwain

A TWAIN lib for dotnet.
MIT License
117 stars 47 forks source link

How to keep the UI displayed #14

Open jueqing1015 opened 4 years ago

jueqing1015 commented 4 years ago

_twain.CurrentSource.Enable(SourceEnableMode.ShowUI, true, this.Handle) After scanning one, the scanner interface will be closed automatically. Is there any way to keep it open because I want to scan continuously @soukoku @soukoku

mikebm commented 7 months ago

Am also trying to figure this out. Did you have any luck figuring it out?

mikebm commented 7 months ago

I've figured it out. TransferLogic.cs This section of code -

        // some poorly written scanner drivers return failure on EndXfer so also check for pending count now.
        // this may break with other sources but we'll see
        if (//pending.Count == 0 && 
            session.State > 5)
        {
            session.ChangeState(5, true);
            session.DisableSource();
        }

You can comment out session.DisableSource();. It is currently designed to disable the source which closes the UI as soon as it finishes the transfer.