Beispiel #1
0
        public ScannerSettings GetScannerSettings()
        {
            Log("Get scanner settings");
            var getSettings = new GetSettings(GetTwainScannerSettings);
            var settings    = _windowsMessageLoop.Invoke <SourceSettings>(getSettings);
            Dictionary <int, string> supportedScanSources = null;

            if (settings.HasADF && settings.HasFlatbed)
            {
                supportedScanSources = new Dictionary <int, string>
                {
                    { (int)ScanFeed.Flatbad, EnumExtensions.GetDescription(ScanFeed.Flatbad) },
                    { (int)ScanFeed.Feeder, EnumExtensions.GetDescription(ScanFeed.Feeder) }
                };
                if (settings.HasDuplex)
                {
                    supportedScanSources.Add((int)ScanFeed.Duplex, EnumExtensions.GetDescription(ScanFeed.Duplex));
                }
            }

            var scannerSettings = new ScannerSettings(Index, Name, settings.FlatbedResolutions, settings.FeederResolutions, TwainPixelTypeExtensions.GetSelectListDictionary(settings.PixelTypes), settings.PhysicalHeight, settings.PhysicalWidth, supportedScanSources);

            Log("Get scanner settings success");
            return(scannerSettings);
        }
		public TwainDotNetScannerManager(WindowsMessageLoopThread windowsMessageLoop)
		{
			_windowsMessageLoop = windowsMessageLoop;
			_sources = new List<TwainDotNetSource>();
			_log = LogManager.GetLogger(typeof(TwainDotNetScannerManager));

			var init = new Init(Initialize);
			_twain = _windowsMessageLoop.Invoke<TwainDotNet.Twain>(init, new object[] { _windowsMessageLoop.Hwnd });

			_log.Info("TwainDotNet scanner manager is used");

			RefreshSources();
		}
        public TwainDotNetScannerManager(WindowsMessageLoopThread windowsMessageLoop)
        {
            _windowsMessageLoop = windowsMessageLoop;
            _sources            = new List <TwainDotNetSource>();
            _log = LogManager.GetLogger(typeof(TwainDotNetScannerManager));

            var init = new Init(Initialize);

            _twain = _windowsMessageLoop.Invoke <TwainDotNet.Twain>(init, new object[] { _windowsMessageLoop.Hwnd });

            _log.Info("TwainDotNet scanner manager is used");

            RefreshSources();
        }