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

Custom Error Message at AcquireError #114

Closed imkarn closed 1 week ago

imkarn commented 1 month ago

Hi Bro i can custom Error Message at AcquireError but i can not disable this Message Before my custom message show

1722918667552

thank you bro

saraff-9EB1047A4BEB4cef8506B29BA325BD5A commented 1 month ago

Hello, @imkarn You can try to handle the Twain32.AcquireError event as follow:

        private void _twain32_AcquireError(object sender,Twain32.AcquireErrorEventArgs e) {
            try {

                var _cc = e.Exception.ConditionCode;
                var _rc = e.Exception.ReturnCode
                var _ex = e.Exception

                switch(_cc) {
                    case TwCC.PaperJam:
                        // <<< handle PaperJam error
                        break;
                    default:
                        // <<< handle other error
                        break;
                }

            } catch(Exception ex) {
                this._ToLog(ex);
            }
        }