using OINA.Extender.Data.Image; using OTSCLRINTERFACE; using OxfordExtenderWrapper; using OTSModelSharp.ServiceCenter; using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Runtime.Remoting.Channels.Ipc; using System.Runtime.Remoting.Channels; using OTSMeasureApp.ServiceCenter.OxfordExtender; namespace OTSMeasureApp.ServiceCenter { class OxfordScanController : IScanController { int imageWidth = 0; int imageHeight = 0; double dwelltime = 0; ExtenderIpcUI iExtender; ImageInputSources imagesourceType; //private APIClass ApiClass = null; public OxfordScanController(ImageInputSources sourceType) { iExtender = ExtenderWrapperIpc.GetExtenderWrapper(); imagesourceType = sourceType; } public CBSEImgClr AcquireBSEImage() { Rectangle r = new Rectangle(); CBSEImgClr bse = new CBSEImgClr(r); bse.InitImageData(imageWidth, imageHeight); //byte[] imgData = new byte[imageWidth * imageHeight]; ImageAquistionParam p = new ImageAquistionParam(); p.width = imageWidth; p.height = imageHeight; p.DwellTime = dwelltime; p.sourceType = imagesourceType; iExtender.AquisitionImage(ref p); bse.SetImageData(p.ImageData, imageWidth, imageHeight); return bse; } public bool Init() { //string FEIIP = FileHelper.GetXMLInformations("FEIIP"); //string FEIPORT = FileHelper.GetXMLInformations("FEIPORT"); //if (FEIIP == "" || FEIPORT == "") //{ // NLog.LogManager.GetCurrentClassLogger().Error("FEI电镜端口配置为空!"); // return false; //} //if (ApiClass.isConnect()) //{ // return true; //} //return ApiClass.Connect(FEIIP, FEIPORT); return true; } public bool SetDwellTime(double val) { dwelltime = val; return true; } public bool SetImageSize(int nWidth, int nHeight) { imageWidth = nWidth; imageHeight = nHeight; //return iExtender.set.SetResolution(imageWidth, imageHeight); ; return true; } } }