Exemple #1
0
        /// <summary>
        /// 返回扫描设备
        /// </summary>
        /// <returns></returns>
        public List <string> GetScanDevs()
        {
            string szDefault = "";

            if (_scanCore == null)
            {
                InitCore();
            }
            List <string> result = new List <string>(_scanCore.GetDrivers(ref szDefault));

            return(result);
        }
Exemple #2
0
        // ==================================================
        // Methods
        // ==================================================

        private void InitTwain()
        {
            try
            {
                TwainToolkit = new TWAINCSToolkit
                               (
                    Handle,
                    WriteOutput,
                    ReportImage,
                    null,
                    "TWAIN Working Group",
                    "TWAIN Sharp",
                    "TWAIN Sharp Scan App",
                    2,
                    3,
                    new string[] { "DF_APP2", "DG_CONTROL", "DG_IMAGE" },
                    "USA",
                    "testing...",
                    "ENGLISH_USA",
                    1,
                    0,
                    false,
                    true
                               );

                var defaultSource = string.Empty;
                var sources       = TwainToolkit.GetDrivers(ref defaultSource);

                if (!sources.Any())
                {
                    throw new Exception("TWAIN GetDrivers returned an empty list.");
                }

                ParseSources(sources);
            }
            catch (Exception error)
            {
                HandleError(Resources.ErrorCannotInitTwain, error);
                return;
            }
        }