VintaSoft Twain .NET SDK Discussions

Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.

Board index < VintaSoft Twain < VintaSoft Twain .NET SDK Discussions

We are migrating to new forums engine, no new registration or posting currently available. TIA for your patience.

Modal scan driver dialog



Modal scan driver dialog

Post by DanielLW »

Hello Vintasoft-team,

i've recognized a problem with the scan driver dialogs. I've set the properties "ShowUI" and "ModalUI" of the Vintasoft.Twain.Device to true, but i still can switch between the scan driver UI and the main application windows.

Example code:
            
            bool bFinished = false;
            Vintasoft.Twain.Device deTest = null;
            Vintasoft.Twain.AcquireModalState amsTest;

            this.dmTest.Open();

            deTest = this.dmTest.DefaultDevice;

            deTest.ShowUI = true;
            deTest.ModalUI = true;
            deTest.ShowIndicators = false;
            deTest.DisableAfterAcquire = false;

            deTest.TransferMode = Vintasoft.Twain.TransferMode.Native;

            deTest.Open();

            deTest.XferCount = -1;
            deTest.DocumentFeeder.Enabled = true;

            // modal acquiring loop
            do
            {
                amsTest = deTest.AcquireModal();

                switch (amsTest)
                {
                    case Vintasoft.Twain.AcquireModalState.ImageAcquired:
                        if (this.pictureBox1.Image != null)
                            this.pictureBox1.Image.Dispose();

                        this.pictureBox1.Image = deTest.AcquiredImage.GetAsBitmap(true);

                        deTest.AcquiredImage.Dispose();

                        break;
                    case Vintasoft.Twain.AcquireModalState.ScanCanceled:
                    case Vintasoft.Twain.AcquireModalState.ScanCompleted:
                    case Vintasoft.Twain.AcquireModalState.ScanFailed:
                    case Vintasoft.Twain.AcquireModalState.UserInterfaceClosed:
                        bFinished = true;
                        break;
                }
            }
            while (!bFinished);

            deTest.Close();

            this.dmTest.Close();
The underlying Vintasoft.Twain.DeviceManager is created with the main application window as parameter in the constructor.

Is this perhaps a known behaviour? Or do i have to call some other method/property to force the twain driver window to be shown as a modal dialog?

Thank you.

Best regards
Daniel


Re: Modal scan driver dialog

Post by Alex »

Hello Daniel,

SDK just notifies TWAIN driver that modal UI must be used, the further behaviour depends from TWAIN driver. Unfortunately many TWAIN drivers ignore modal flag. In our demos we disable application UI before image scan and enable application UI when scan is finished.

Best regards, Alexander


Page 1 from 1: 1