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

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<string> 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<string> GetPixelVideoListAsync(int index)
{
CameraGrah grah = new CameraGrah();
var dialogres = await grah.GetPixelVideoList(index);
string res = JsonHelper.SerializeObject(dialogres);
return res;
}
public async Task<string> GetDeviceVideoListAsync()
{
CameraGrah grah = new CameraGrah();
var dialogres = await grah.GetDeviceVideoList();
string res = JsonHelper.SerializeObject(dialogres);
return res;
}
}
}