You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.4 KiB

1 month ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Forms;
  7. using ShenTun.ImageCollection.AForgeCamera;
  8. using ShenTun.ImageCollection.Common;
  9. namespace ShenTun.ImageCollection.Instance
  10. {
  11. public class ClientAcquisition
  12. {
  13. public async Task<string> ShowCameraAsync(RequestInterface req)
  14. {
  15. DialogResponse dialogres = new DialogResponse()
  16. {
  17. code = -1,
  18. message = "",
  19. };
  20. if (req.AcquisitionInterface == 1)//DirectShow
  21. {
  22. if (req.mode.Equals(3))
  23. {
  24. object data;
  25. FrmCamera progressForm = new FrmCamera(req);
  26. var progressFormTask = await progressForm.ShowDialogAsync();
  27. try
  28. {
  29. data = progressForm.Result;
  30. }
  31. finally
  32. {
  33. progressForm.Close();
  34. }
  35. dialogres = progressForm.Result;
  36. progressForm.Close();
  37. }
  38. else
  39. {
  40. try {
  41. CameraGrah grah = new CameraGrah();
  42. dialogres = await grah.GetImage(req);
  43. }
  44. catch (Exception ex) {
  45. MessageBox.Show(ex.Message);
  46. }
  47. }
  48. }
  49. string res = JsonHelper.SerializeObject(dialogres);
  50. return res;
  51. }
  52. public async Task ShowImageListAsync(RequestImageEdit req)
  53. {
  54. FrmImageList progressForm = new FrmImageList(req);
  55. await progressForm.ShowDialogAsync();
  56. }
  57. public async Task<string> GetPixelVideoListAsync(int index)
  58. {
  59. CameraGrah grah = new CameraGrah();
  60. var dialogres = await grah.GetPixelVideoList(index);
  61. string res = JsonHelper.SerializeObject(dialogres);
  62. return res;
  63. }
  64. public async Task<string> GetDeviceVideoListAsync()
  65. {
  66. CameraGrah grah = new CameraGrah();
  67. var dialogres = await grah.GetDeviceVideoList();
  68. string res = JsonHelper.SerializeObject(dialogres);
  69. return res;
  70. }
  71. }
  72. }