ResourceData.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. using OTSDataType;
  2. namespace OTSModelSharp.ResourceManage
  3. {
  4. public enum OTS_SAMPLE_PROP_GRID_ITEM_GROUPS
  5. {
  6. INVALID = -1,
  7. MIN = 0,
  8. GENERAL = 0,
  9. IMAGESCAN = 1,
  10. IMAGE_PROCESS = 2,
  11. XRAY = 3,
  12. SEM = 4,
  13. MEASURE_STATUS = 5,
  14. MEASURE_RESULTS = 6,
  15. MAX = 6
  16. }
  17. //every possible display item in the sample property grid should be a member in this enum.
  18. public enum OTS_SAMPLE_PROP_GRID_ITEMS
  19. {// we prepare 10 items for every group.so the first group starts from 0,the second starts from 10,and so on.
  20. //the item's value is corresponding to the position exactly when it's displayed in the property grid.and the caption string is read from the resource file by the value too.
  21. SAMPLE_NAME = 20000,
  22. SAMPLE_HOLE_NAME = 20001,
  23. SWITCH = 20002,
  24. MEASURE_PARAM_FILE_NAME = 20003,
  25. STD_FILE_NAME = 20004,
  26. MEMBRANE_TYPE = 20005,
  27. STEEL_TECHNOLOGY = 20006,
  28. SYS_STD_SWITCH = 20008,
  29. START_PHOTO_MODE = 20010,
  30. STOP_MODE = 20011,
  31. STOP_PARAM_PARTICLE = 20012,
  32. STOP_PARAM_FIELD = 20013,
  33. STOP_PARAM_TIME = 20014,
  34. STOP_PARAM_AREA = 20015,
  35. SCAN_SPEED = 20016,
  36. IMAGE_RESOLUTION = 20017,
  37. PARTICLE_AREA_MIN = 20020,
  38. PARTICLE_AREA_MAX = 20021,
  39. BG_GRAY_MIN = 20022,
  40. BG_GRAY_MAX = 20023,
  41. PARTICLE_GRAY_MIN = 20024,
  42. PARTICLE_GRAY_MAX = 20025,
  43. BGREMOVE_TYPE = 20026,
  44. AUTOBGREMOVE_TYPE = 20027,//Auto BGremove still has three types to choose
  45. OtherSelection = 20029,
  46. MATRIXSTEP = 20030,
  47. ANALYSIS_RESOLUTION = 20032,
  48. XRAYSCAN_MODE = 20033,
  49. ANALYSIS_COUNTS = 20034,
  50. XRAY_QUANTIFY_MINSIZE = 20036,
  51. XRAY_FASTTIME = 20037,
  52. USING_XRAY = 20038,
  53. XrayLimit=20039,
  54. MAGNIFICATION = 20040,
  55. PIXEL_SIZE = 20041,
  56. WORKING_DISTANCE = 20042,
  57. BRIGHTNESS=20043,
  58. CONTRAST=20044,
  59. HV=20045,
  60. TOTAL_FIELDS = 20046,
  61. TOTAL_TO_MEASURE_AREA = 20047,
  62. MEASURE_STATAU = 20050,
  63. START_TIME = 20051,
  64. USED_TIME = 20052,
  65. FINISH_TIME = 20053,
  66. COMPLETED_FIELDS = 20054,
  67. RATIO = 20060,
  68. TOTAL_AREA = 20061,
  69. TOTAL_PARTICLE = 20062,
  70. TOTAL_PARTICLE_AREA = 20063,
  71. }
  72. public class ResourceData
  73. {
  74. public void LoadXmlData()
  75. {
  76. XmlResourceData.GetInstance().LoadStringFromXml();
  77. }
  78. public static OTS_SAMPLE_PROP_GRID_ITEM_GROUPS GetResourceGrpIdOfPropItem(OTS_SAMPLE_PROP_GRID_ITEMS itm)
  79. {
  80. OTS_SAMPLE_PROP_GRID_ITEM_GROUPS g = 0;
  81. var itmNo = (int)itm;
  82. if (itmNo >= 20000 && itmNo <= 20009)
  83. {
  84. g = OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.GENERAL;
  85. }
  86. if (itmNo >= 20010 && itmNo <= 20019)
  87. {
  88. g = OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.IMAGESCAN;
  89. }
  90. if (itmNo >= 20020 && itmNo <= 20029)
  91. {
  92. g = OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.IMAGE_PROCESS;
  93. }
  94. if (itmNo >= 20030 && itmNo <= 20039)
  95. {
  96. g = OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.XRAY;
  97. }
  98. if (itmNo >= 20040 && itmNo <= 20049)
  99. {
  100. g = OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.SEM;
  101. }
  102. if (itmNo >= 20050 && itmNo <= 20059)
  103. {
  104. g = OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.MEASURE_STATUS;
  105. }
  106. if (itmNo >= 20060 && itmNo <= 20069)
  107. {
  108. g = OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.MEASURE_STATUS;
  109. }
  110. return g;
  111. }
  112. public static StringResource GetStringResourceByKey(OTS_SAMPLE_PROP_GRID_ITEM_GROUPS grp, OTS_SAMPLE_PROP_GRID_ITEMS itm)
  113. {
  114. return XmlResourceData.GetInstance().GetStringResourceByKey(grp, itm);
  115. }
  116. public static string GetStopModeIdString(otsdataconst.OTS_MEASURE_STOP_MODE a_nStopMode)
  117. {
  118. string strStopModeId = "";
  119. strStopModeId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_SCANSTOPMODE + (int)a_nStopMode);
  120. return strStopModeId;
  121. }
  122. // get scan speed
  123. public static string GetScanSpeedString(otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS a_nScanSpeed)
  124. {
  125. string strScanSpeedId = "";
  126. strScanSpeedId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_SCANSPEED + (int)a_nScanSpeed);
  127. return strScanSpeedId;
  128. }
  129. // get image mode id
  130. public static string GetImageModeString(otsdataconst.OTS_GET_IMAGE_MODE a_nGetImageMode)
  131. {
  132. string strGetImageId = "";
  133. strGetImageId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_FETCHIMAGEMODE + (int)a_nGetImageMode);
  134. return strGetImageId;
  135. }
  136. // get XRay analysis speed id
  137. public static string GetXRayAnalySpeedIdString(otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS a_nXRayAnalySpeed)
  138. {
  139. string strXRayAnalySpeedId = "";
  140. strXRayAnalySpeedId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_ANALYSPEED + (int)a_nXRayAnalySpeed);
  141. return strXRayAnalySpeedId;
  142. }
  143. // get XRay scan mode id
  144. public static string GetXRayScanModeIdString(otsdataconst.OTS_X_RAY_SCAN_MODE a_nXRayScanMode)
  145. {
  146. string strXRayScanModeId = "";
  147. strXRayScanModeId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_XRAYSCANMODE + (int)a_nXRayScanMode);
  148. return strXRayScanModeId;
  149. }
  150. // get XAxis direction id
  151. public static string GetXAxisDirectionIdString(otsdataconst.OTS_X_AXIS_DIRECTION a_nXAxisDirection)
  152. {
  153. string strXAxisDirectionId = "";
  154. strXAxisDirectionId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_XAXISDIRECTION + (int)a_nXAxisDirection);
  155. return strXAxisDirectionId;
  156. }
  157. // get YAxis direction id
  158. public static string GetYAxisDirectionIdString(otsdataconst.OTS_Y_AXIS_DIRECTION a_nYAxisDirection)
  159. {
  160. string strYAxisDirectionId = "";
  161. strYAxisDirectionId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_YAXISDIRECTION + (int)a_nYAxisDirection);
  162. return strYAxisDirectionId;
  163. }
  164. public static string GetSteelTechIdString(otsdataconst.STEEL_TECHNOLOGY a_nSteelTech)
  165. {
  166. string strId = "";
  167. strId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_MEMBRANE_TYPE + (int)a_nSteelTech);
  168. return strId;
  169. }
  170. // get measure area shape
  171. public static string GetAreaShapeString(otsdataconst.MEASURE_SHAPE a_nShape)
  172. {
  173. string strShape = "";
  174. strShape = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_MEASURE_SHAPE + (int)a_nShape);
  175. return strShape;
  176. }
  177. //get model
  178. public static string GetRunModeString(otsdataconst.RunMode a_nMode)
  179. {
  180. string strMode = "";
  181. strMode = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_MEASURE_StartMode + (int)a_nMode);
  182. return strMode;
  183. }
  184. //get FrameEndMode
  185. public static string GetFrameEndModeString(otsdataconst.FrameEndMode a_nModel)
  186. {
  187. string strFrameEndMode = "";
  188. strFrameEndMode = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_MEASURE_FrameEndMode + (int)a_nModel);
  189. return strFrameEndMode;
  190. }
  191. //get AUTOBGREMOVETYPE
  192. public static string GetBGREMOVETYPEString(otsdataconst.OTS_AUTOBGREMOVETYPE a_nAUTOBGREMOVETYPE)
  193. {
  194. string strAUTOBGREMOVETYPES = "";
  195. strAUTOBGREMOVETYPES = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpImageProcess, ResourceID.IDS_BGREMOVE_TYPE + (int)a_nAUTOBGREMOVETYPE);
  196. return strAUTOBGREMOVETYPES;
  197. }
  198. //get IMAGEMODE
  199. public static string GetAUTOBGREMOVETYPEString(otsdataconst.OTS_IMAGE_MODE a_nIMAGEMODE)
  200. {
  201. string strIMAGEMODE = "";
  202. strIMAGEMODE = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_AUTOBGREMOVE_TYPE + (int)a_nIMAGEMODE);
  203. return strIMAGEMODE;
  204. }
  205. //get USINGXRAY
  206. public static string GetUSINGXRAYSIdString(otsdataconst.OTS_USING_X_RAY a_nUSINGXRAY)
  207. {
  208. string strUSINGXRAY = "";
  209. strUSINGXRAY = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpMeasureResult, ResourceID.IDS_USINGXRAYS + (int)a_nUSINGXRAY);
  210. return strUSINGXRAY;
  211. }
  212. public static string GetSourceTitleString(OTS_SAMPLE_PROP_GRID_ITEM_GROUPS rowIndex)
  213. {
  214. string strSourceName = "";
  215. strSourceName = XmlResourceData.GetInstance().GetGroupTextByKey((int)rowIndex);
  216. return strSourceName;
  217. }
  218. public static string GetSourceColNameString(int resourceGrp, int rowIndex)
  219. {
  220. string strSourceName = "";
  221. strSourceName = XmlResourceData.GetInstance().GetStringByKey(resourceGrp, rowIndex);
  222. return strSourceName;
  223. }
  224. public static string GetResourceByKey(int resourceGrp, int Index)
  225. {
  226. string strSource = XmlResourceData.GetInstance().GetStringByKey(resourceGrp, Index);
  227. return strSource;
  228. }
  229. }
  230. }