123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
-
- using OxfordExtenderWrapper;
- using OTSModelSharp.ServiceCenter;
- using System;
- using System.Collections.Generic;
- 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;
- using System.Threading;
- namespace OTSMeasureApp.ServiceCenter
- {
- class OxfordSemController : ISemController
- {
- ExtenderIpcUI iExtender;
- public OxfordSemController()
- {
-
- iExtender = ExtenderWrapperIpc.GetExtenderWrapper();
- }
- public bool Connect()
- {
- try
- {
- iExtender = ExtenderWrapperIpc.GetExtenderWrapper();
- }
- catch (Exception e)
- {
- NLog.LogManager.GetCurrentClassLogger().Warn(e.Message);
- }
-
- return true;
- }
- public bool DisConnect()
- {
- try
- {
-
- iExtender.CloseExtender();
- //ExtenderWrapperIpc.KillExtenderWrapperProcess();
- }
- catch (Exception e)
- {
- NLog.LogManager.GetCurrentClassLogger().Warn(e.Message);
-
- }
-
- return true;
- }
-
- public bool GetMagnification(ref double a_dMagnification)
- {
- a_dMagnification= iExtender.GetMagnification();
- return true;
- }
- public bool GetSemBeamBlank(ref int a_nBeamBlank)
- {
-
- a_nBeamBlank = 1;
- return true;
-
- }
- public bool GetSemBrightness(ref double a_dBrightness)
- {
-
- a_dBrightness = iExtender.GetBrightness();
- return true;
- }
- public bool GetSemContrast(ref double a_dContrast)
- {
-
- a_dContrast = iExtender.GetContrast();
- return true;
- }
- public bool GetSemHighTension(ref double a_dKV)
- {
-
- a_dKV = iExtender.GetSEMVoltage() / 1000;
- return true;
- }
- public bool GetSemPositionXY(ref double a_dPositionX, ref double a_dPositionY, ref double a_dPositionR)
- {
- a_dPositionX = iExtender.GetStageAtX();
- a_dPositionY = iExtender.GetStageAtY();
- a_dPositionR = iExtender.GetStageAtR();
- return true;
- }
- public bool GetWorkingDistance(ref double a_distance)
- {
- a_distance= iExtender.GetWorkingDistance();
- return true;
- }
- public bool IsConnected()
- {
- if (Connect())
- {
- return true;
- }
- else
- {
- return false;
- }
-
- }
- public bool MoveSEMToPoint(double a_dPositionX, double a_dPositionY, double rotation)
- {
- var b1= iExtender.MoveStageXY((float)a_dPositionX, (float)a_dPositionY);
- var b2=iExtender.SetStageGotoR((float)rotation);
-
- return b1&b2;
- }
- public bool MoveSEMToPoint(double a_dPositionX, double a_dPositionY)
- {
- var b= iExtender.MoveStageXY((float)a_dPositionX, (float)a_dPositionY);
-
- return b;
- }
- public bool SetMagnification(double a_dMagnification)
- {
- return iExtender.SetMagnification((float)a_dMagnification);
- }
- public bool SetScanExternal(bool b)
- {
- return iExtender.SetSemScanExternal(b);
- }
-
- public bool SetSemBeamOn(bool val)
- {
- return iExtender.SetBeamAndFilamentOnOrOff(val);
- }
- public bool GetSemBeamOn()
- {
- return iExtender.GetSemBeamOn();
- }
- public bool SetSemBrightness(double a_dBrightness)
- {
- return iExtender.SetBrightness((float)a_dBrightness);
- }
- public bool SetSemContrast(double a_dContrast)
- {
- return iExtender.SetContrast((float)a_dContrast);
- }
- public bool SetSemHighTension(double a_dKV)
- {
- return iExtender.SetSEMVoltage((float)a_dKV);
- }
- public bool SetWorkingDistance(double a_distance)
- {
- return iExtender.SetWorkingDistance((float)a_distance);
- }
- public void StopXrayAcquisition()
- {
- iExtender.StopXrayAquisition();
-
- }
- public bool GetScanFieldSize(ref double dScanFieldSizeX, ref double dScanFieldSizeY)
- {
- throw new NotImplementedException();
- }
- public bool SetSemBeamCurrentOff(bool val)
- {
- return iExtender.SetBeamAndFilamentOnOrOff(val);
- }
- public bool SetSemBeamBlank(bool val)
- {
- return iExtender.SetBeamAndFilamentOnOrOff(val);
- }
- bool ISemController.StopXrayAcquisition()
- {
- return true;
- }
- public bool SetSemHTOff(bool value)
- {
- return iExtender.SetBeamAndFilamentOnOrOff(value);
- }
- public bool RunHIGH_VACUUM()
- {
- return true;
- }
- public bool StopImageAcquisition()
- {
- return true;
- }
- public bool SetReducedArea()
- {
- return true;
- }
- public bool SetFullFrame()
- {
- return true;
- }
- }
- }
|