using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using ShenTun.ImageCollection.AForgeCamera; using ShenTun.ImageCollection.Common; namespace ShenTun.ImageCollection.Instance { public class ClientAcquisition { public async Task ShowCameraAsync(RequestInterface req) { DialogResponse dialogres = new DialogResponse() { code = -1, message = "", }; if (req.AcquisitionInterface == 1)//DirectShow { if (req.mode.Equals(3)) { object data; FrmCamera progressForm = new FrmCamera(req); var progressFormTask = await progressForm.ShowDialogAsync(); try { data = progressForm.Result; } finally { progressForm.Close(); } dialogres = progressForm.Result; progressForm.Close(); } else { try { CameraGrah grah = new CameraGrah(); dialogres = await grah.GetImage(req); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } string res = JsonHelper.SerializeObject(dialogres); return res; } public async Task ShowImageListAsync(RequestImageEdit req) { FrmImageList progressForm = new FrmImageList(req); await progressForm.ShowDialogAsync(); } public async Task GetPixelVideoListAsync(int index) { CameraGrah grah = new CameraGrah(); var dialogres = await grah.GetPixelVideoList(index); string res = JsonHelper.SerializeObject(dialogres); return res; } public async Task GetDeviceVideoListAsync() { CameraGrah grah = new CameraGrah(); var dialogres = await grah.GetDeviceVideoList(); string res = JsonHelper.SerializeObject(dialogres); return res; } } }