OxfordSemController.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. 
  2. using OxfordExtenderWrapper;
  3. using OTSModelSharp.ServiceCenter;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Runtime.Remoting.Channels.Ipc;
  10. using System.Runtime.Remoting.Channels;
  11. using OTSMeasureApp.ServiceCenter.OxfordExtender;
  12. using System.Threading;
  13. namespace OTSMeasureApp.ServiceCenter
  14. {
  15. class OxfordSemController : ISemController
  16. {
  17. ExtenderIpcUI iExtender;
  18. public OxfordSemController()
  19. {
  20. iExtender = ExtenderWrapperIpc.GetExtenderWrapper();
  21. }
  22. public bool Connect()
  23. {
  24. return true;
  25. }
  26. public bool DisConnect()
  27. {
  28. try
  29. {
  30. iExtender.CloseExtender();
  31. ExtenderWrapperIpc.CloseExtenderWrapper();
  32. }
  33. catch (Exception e)
  34. {
  35. NLog.LogManager.GetCurrentClassLogger().Warn(e.Message);
  36. }
  37. return true;
  38. }
  39. public bool GetMagnification(ref double a_dMagnification)
  40. {
  41. a_dMagnification= iExtender.GetMagnification();
  42. return true;
  43. }
  44. public bool GetSemBeamBlank(ref int a_nBeamBlank)
  45. {
  46. a_nBeamBlank = 1;
  47. return true;
  48. }
  49. public bool GetSemBrightness(ref double a_dBrightness)
  50. {
  51. a_dBrightness = iExtender.GetBrightness();
  52. return true;
  53. }
  54. public bool GetSemContrast(ref double a_dContrast)
  55. {
  56. a_dContrast = iExtender.GetContrast();
  57. return true;
  58. }
  59. public bool GetSemHighTension(ref double a_dKV)
  60. {
  61. a_dKV = iExtender.GetSEMVoltage() / 1000;
  62. return true;
  63. }
  64. public bool GetSemPositionXY(ref double a_dPositionX, ref double a_dPositionY, ref double a_dPositionR)
  65. {
  66. a_dPositionX = iExtender.GetStageAtX();
  67. a_dPositionY = iExtender.GetStageAtY();
  68. a_dPositionR = iExtender.GetStageAtR();
  69. return true;
  70. }
  71. public bool GetWorkingDistance(ref double a_distance)
  72. {
  73. a_distance= iExtender.GetWorkingDistance();
  74. return true;
  75. }
  76. public bool IsConnected()
  77. {
  78. return true;
  79. }
  80. public bool MoveSEMToPoint(double a_dPositionX, double a_dPositionY, double rotation)
  81. {
  82. var b1= iExtender.MoveStageXY((float)a_dPositionX, (float)a_dPositionY);
  83. var b2=iExtender.SetStageGotoR((float)rotation);
  84. return b1&b2;
  85. }
  86. public bool MoveSEMToPoint(double a_dPositionX, double a_dPositionY)
  87. {
  88. var b= iExtender.MoveStageXY((float)a_dPositionX, (float)a_dPositionY);
  89. Thread.Sleep(500);
  90. return b;
  91. }
  92. public bool SetMagnification(double a_dMagnification)
  93. {
  94. return iExtender.SetMagnification((float)a_dMagnification);
  95. }
  96. public bool SetScanExternal(bool b)
  97. {
  98. return iExtender.SetSemScanExternal(b);
  99. }
  100. public bool SetSemBeamOn(bool val)
  101. {
  102. return true;
  103. }
  104. public bool GetSemBeamOn()
  105. {
  106. return iExtender.GetSemBeamOn();
  107. }
  108. public bool SetSemBrightness(double a_dBrightness)
  109. {
  110. return iExtender.SetBrightness((float)a_dBrightness);
  111. }
  112. public bool SetSemContrast(double a_dContrast)
  113. {
  114. return iExtender.SetContrast((float)a_dContrast);
  115. }
  116. public bool SetSemHighTension(double a_dKV)
  117. {
  118. return iExtender.SetSEMVoltage((float)a_dKV);
  119. }
  120. public bool SetWorkingDistance(double a_distance)
  121. {
  122. return iExtender.SetWorkingDistance((float)a_distance);
  123. }
  124. public void StopXrayAcquisition()
  125. {
  126. iExtender.StopXrayAquisition();
  127. }
  128. public bool GetScanFieldSize(ref double dScanFieldSizeX, ref double dScanFieldSizeY)
  129. {
  130. throw new NotImplementedException();
  131. }
  132. public bool SetScanFieldSize100(double dScanFieldSizeX, double dScanFieldSizeY)
  133. {
  134. throw new NotImplementedException();
  135. }
  136. public bool GetScanFieldSize100(ref double dScanFieldSizeX, ref double dScanFieldSizeY)
  137. {
  138. throw new NotImplementedException();
  139. }
  140. public bool SetSemBeamCurrent(bool a_dKV)
  141. {
  142. throw new NotImplementedException();
  143. }
  144. public bool SetSemBeamBlank(bool a_dKV)
  145. {
  146. throw new NotImplementedException();
  147. }
  148. bool ISemController.StopXrayAcquisition()
  149. {
  150. throw new NotImplementedException();
  151. }
  152. }
  153. }