ScanTool.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Forms;
  8. using WIA;
  9. namespace HXX.Scanner.Biz
  10. {
  11. /// <summary>
  12. /// 老类,似乎废弃
  13. /// </summary>
  14. public class ScanTool
  15. {
  16. public string scannerName = "";
  17. public WIA.Properties scannerProps = null;
  18. //Device scanner = null;
  19. //public void GetDeviceInfo(ComboBox scanList)
  20. public void GetDeviceInfo()
  21. {
  22. //scanList.Items.Clear();
  23. scanner_manager.Clear();
  24. DeviceManager dm = new DeviceManagerClass();
  25. DeviceInfos dis = dm.DeviceInfos;
  26. Boolean hasScanner = false;
  27. foreach (DeviceInfo di in dis)
  28. {
  29. //Console.WriteLine(di.Type.ToString());
  30. if (di.Type == WiaDeviceType.ScannerDeviceType)
  31. {
  32. scannerProps = di.Properties;
  33. foreach (Property p in scannerProps)
  34. {
  35. Console.WriteLine(p.Name + " > " + p.get_Value().ToString());
  36. if (p.Name == "Name")
  37. {
  38. scannerName = p.get_Value().ToString();
  39. }
  40. }
  41. hasScanner = true;
  42. Device_Scanner sc = new Device_Scanner(di);
  43. //scanList.Items.Add(sc);
  44. scanner_manager.Add(sc);
  45. }
  46. }
  47. //if (hasScanner)
  48. //{
  49. // scanList.SelectedIndex = 0;
  50. //}
  51. }
  52. public ImageFile test(string dir, Device_Scanner scanner, string test)
  53. {
  54. return scanner.ScanTIFFTest(dir, test);
  55. }
  56. }
  57. }