public void NearStandartFormat()
 {
     var scannerSettings = new ScannerSettings(0, "test", null, null, 11.69f, 8.27f);
     scannerSettings = new ScannerSettings(0, "test", null, null, 11.73f, 8.31f);
     scannerSettings = new ScannerSettings(0, "test", null, null, 11.66f, 8.23f);
     scannerSettings = new ScannerSettings(0, "test", null, null, 13, 10.23f);
     scannerSettings = new ScannerSettings(0, "test", null, null, 40, 50);
     scannerSettings = new ScannerSettings(0, "test", null, null, 10.23f, 13);
 }
Example #2
0
		public ScannerSettings GetScannerSettings()
		{
			if (_source == null)
			{
				throw new Exception("Не выбран источник данных для сканера.");
			}

			var settings = new ScannerSettings(
				Index,
				Name,
				GetAllowableResolutions(),
				//todo: 
				GetAllowableResolutions(),
				GetAllowablePixelTypes(),
				GetMaxHeight(),
				GetMaxWidth());

			return settings;
		}
		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;
		}
Example #4
0
		public ScannerSettings GetScannerSettings()
		{
			Log("Get scanner settings");
			if (_deviceId == null)
			{
				throw new Exception("Не выбран источник данных для сканера.");
			}

			// connect to scanner
			var device = ConnectToDevice();
			var source = device.Items[1];

			var supportedScanFeeds = GetSupportedDocumentHandlingCaps(device);
			List<float> flatbedResolutions = null;
			List<float> feederResolutions = null;

			if (supportedScanFeeds == null || supportedScanFeeds.Count == 0 || !IsDocumentHandlingSelectSupported(device))
			{
				flatbedResolutions = GetAllowableResolutions(source);
			}
			else
			{
				if (supportedScanFeeds.ContainsKey((int) ScanFeed.Flatbad))
				{
					Debug("Getting resolutions for Flatbad");
					try
					{
						SetProperty(device.Properties, WiaProperty.DocumentHandlingSelect, WIA_DPS_DOCUMENT_HANDLING_SELECT.Flatbad);
					}
					catch (Exception e)
					{
						Debug("Can't set DocumentHandlingSelect to Flatbad, " + e);
					}
					flatbedResolutions = GetAllowableResolutions(source);
				}
				
				if (supportedScanFeeds.ContainsKey((int) ScanFeed.Feeder))
				{
					Debug("Getting resolutions for Feeder");
					try
					{
						SetProperty(device.Properties, WiaProperty.DocumentHandlingSelect, WIA_DPS_DOCUMENT_HANDLING_SELECT.Feeder);
					}
					catch (Exception e)
					{
						Debug("Can't set DocumentHandlingSelect to Feeder, " + e);
					}
					feederResolutions = GetAllowableResolutions(source);
				}
			}
			var settings = new ScannerSettings(
				_sourceIndex,
				_name,
				flatbedResolutions,
				feederResolutions,
				GetAllowablePixelTypes(),
				GetMaxHeight(device),
				GetMaxWidth(device),
				supportedScanFeeds);

			Log("Get scanner settings success");

			return settings;
		}
Example #5
0
 public ScannerParametersQueryResult(List <ISource> sources, ScannerSettings settings, int?sourceIndex)
 {
     _sourceIndex = sourceIndex;
     _sources     = sources;
     _settings    = settings;
 }
		public ScannerParametersQueryResult(List<ISource> sources, ScannerSettings settings, int? sourceIndex)
		{
			_sourceIndex = sourceIndex;
			_sources = sources;
			_settings = settings;
		}