| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 | using OTSDataType;namespace OTSModelSharp.ResourceManage{    public enum OTS_SAMPLE_PROP_GRID_ITEM_GROUPS    {        INVALID = -1,        MIN = 0,        GENERAL = 0,        IMAGESCAN = 1,        IMAGE_PROCESS = 2,        XRAY = 3,              SEM = 4,        MEASURE_STATUS = 5,        MEASURE_RESULTS = 6,        MAX = 6    }    //every possible display item in the sample property grid should be a member in this enum.    public enum OTS_SAMPLE_PROP_GRID_ITEMS    {// we prepare 10 items for every group.so the first group starts from 0,the second starts from 10,and so on.     //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.                SAMPLE_NAME = 20000,        SAMPLE_HOLE_NAME = 20001,        SWITCH = 20002,        MEASURE_PARAM_FILE_NAME = 20003,        STD_FILE_NAME = 20004,        MEMBRANE_TYPE = 20005,        STEEL_TECHNOLOGY = 20006,        //ROCK_TYPE = 7,        SYS_STD_SWITCH = 20008,                      START_PHOTO_MODE = 20010,        STOP_MODE = 20011,        STOP_PARAM_PARTICLE = 20012,        STOP_PARAM_FIELD = 20013,        STOP_PARAM_TIME = 20014,        STOP_PARAM_AREA = 20015,        SCAN_SPEED = 20016,        IMAGE_RESOLUTION = 20017,                    PARTICLE_AREA_MIN = 20020,        PARTICLE_AREA_MAX = 20021,        BG_GRAY_MIN = 20022,        BG_GRAY_MAX = 20023,        PARTICLE_GRAY_MIN = 20024,        PARTICLE_GRAY_MAX = 20025,        BGREMOVE_TYPE = 20026,        AUTOBGREMOVE_TYPE = 20027,//Auto BGremove still has three types to choose               //SEARCH_RESOLUTION = 30,        //LOW_COUNTS = 31,        ANALYSIS_RESOLUTION = 20032,        XRAYSCAN_MODE = 20033,        ANALYSIS_COUNTS = 20034,        //XRAY_STEP = 35,        XRAY_QUANTIFY_MINSIZE = 20036,        XRAY_FASTTIME = 20037,        USING_XRAY = 20038,        XrayLimit=20039,               MAGNIFICATION = 20040,        IMAGERESOLUTION_SIZE = 20041,        WORKING_DISTANCE = 20042,        TOTAL_FIELDS = 20043,        TOTAL_TO_MEASURE_AREA = 20044,               MEASURE_STATAU = 20050,        START_TIME = 20051,        USED_TIME = 20052,        FINISH_TIME = 20053,        COMPLETED_FIELDS = 20054,                     RATIO = 20060,        TOTAL_AREA = 20061,        TOTAL_PARTICLE = 20062,        TOTAL_PARTICLE_AREA = 20063,                 }    public class ResourceData    {        public void LoadXmlData()        {            XmlResourceData.GetInstance().LoadStringFromXml();        }        public static OTS_SAMPLE_PROP_GRID_ITEM_GROUPS GetResourceGrpIdOfPropItem(OTS_SAMPLE_PROP_GRID_ITEMS itm)        {            OTS_SAMPLE_PROP_GRID_ITEM_GROUPS g = 0;            var itmNo = (int)itm;            if (itmNo >= 20000 && itmNo <= 20009)            {                g = OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.GENERAL;            }            if (itmNo >= 20010 && itmNo <= 20019)            {                g = OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.IMAGESCAN;            }            if (itmNo >= 20020 && itmNo <= 20029)            {                g = OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.IMAGE_PROCESS;            }            if (itmNo >= 20030 && itmNo <= 20039)            {                g = OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.XRAY;            }            if (itmNo >= 20040 && itmNo <= 20049)            {                g = OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.SEM;            }            if (itmNo >= 20050 && itmNo <= 20059)            {                g = OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.MEASURE_STATUS;            }            if (itmNo >= 20060 && itmNo <= 20069)            {                g = OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.MEASURE_STATUS;            }            return g;        }        public static StringResource GetStringResourceByKey(OTS_SAMPLE_PROP_GRID_ITEM_GROUPS grp, OTS_SAMPLE_PROP_GRID_ITEMS itm)        {            return XmlResourceData.GetInstance().GetStringResourceByKey(grp, itm);        }        public static string GetStopModeIdString(otsdataconst.OTS_MEASURE_STOP_MODE a_nStopMode)        {            string strStopModeId = "";                           strStopModeId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_SCANSTOPMODE + (int)a_nStopMode);                      return strStopModeId;        }        // get scan speed        public static string GetScanSpeedString(otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS a_nScanSpeed)        {            string strScanSpeedId = "";                           strScanSpeedId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_SCANSPEED + (int)a_nScanSpeed);                      return strScanSpeedId;        }        // get image size id        public static string GetImageSizeIdString(otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS a_nImageSize)        {            string strImageSizeId = "";                            strImageSizeId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_SCANSIZE + (int)a_nImageSize);                        return strImageSizeId;        }        // get image mode id        public static string GetGetImageIdString(otsdataconst.OTS_GET_IMAGE_MODE a_nGetImageMode)        {            string strGetImageId = "";                           strGetImageId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_FETCHIMAGEMODE + (int)a_nGetImageMode);                       return strGetImageId;        }        // get XRay analysis speed id        public static string GetXRayAnalySpeedIdString(otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS a_nXRayAnalySpeed)        {            string strXRayAnalySpeedId = "";                           strXRayAnalySpeedId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_ANALYSPEED + (int)a_nXRayAnalySpeed);                       return strXRayAnalySpeedId;        }        // get XRay scan mode id        public static string GetXRayScanModeIdString(otsdataconst.OTS_X_RAY_SCAN_MODE a_nXRayScanMode)        {            string strXRayScanModeId = "";                           strXRayScanModeId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_XRAYSCANMODE + (int)a_nXRayScanMode);                       return strXRayScanModeId;        }         // get XAxis direction id        public static string GetXAxisDirectionIdString(otsdataconst.OTS_X_AXIS_DIRECTION a_nXAxisDirection)        {            string strXAxisDirectionId = "";                          strXAxisDirectionId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_XAXISDIRECTION + (int)a_nXAxisDirection);                      return strXAxisDirectionId;        }        // get YAxis direction id        public static string GetYAxisDirectionIdString(otsdataconst.OTS_Y_AXIS_DIRECTION a_nYAxisDirection)        {                        string strYAxisDirectionId = "";                          strYAxisDirectionId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_YAXISDIRECTION + (int)a_nYAxisDirection);                      return strYAxisDirectionId;        }        public static string GetSteelTechIdString(otsdataconst.STEEL_TECHNOLOGY a_nSteelTech)        {            string strId = "";                           strId = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_MEMBRANE_TYPE + (int)a_nSteelTech);                      return strId;        }        // get measure area shape        public static string GetAreaShapeString(otsdataconst.MEASURE_SHAPE a_nShape)        {            string strShape = "";                            strShape = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_MEASURE_SHAPE + (int)a_nShape);                       return strShape;        }        //get model        public static string GetRunModeString(otsdataconst.RunMode a_nMode)        {            string strMode = "";                           strMode = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_MEASURE_StartMode + (int)a_nMode);                      return strMode;        }        //get FrameEndMode        public static string GetFrameEndModeString(otsdataconst.FrameEndMode a_nModel)        {            string strFrameEndMode = "";                           strFrameEndMode = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_MEASURE_FrameEndMode + (int)a_nModel);                       return strFrameEndMode;        }        //get AUTOBGREMOVETYPE        public static string GetBGREMOVETYPEString(otsdataconst.OTS_AUTOBGREMOVETYPE a_nAUTOBGREMOVETYPE)        {            string strAUTOBGREMOVETYPES = "";                           strAUTOBGREMOVETYPES = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpImageProcess, ResourceID.IDS_BGREMOVE_TYPE + (int)a_nAUTOBGREMOVETYPE);                       return strAUTOBGREMOVETYPES;        }        //get IMAGEMODE        public static string GetAUTOBGREMOVETYPEString(otsdataconst.OTS_IMAGE_MODE a_nIMAGEMODE)        {            string strIMAGEMODE = "";                            strIMAGEMODE = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpOtherParam, ResourceID.IDS_AUTOBGREMOVE_TYPE + (int)a_nIMAGEMODE);                       return strIMAGEMODE;        }        //get USINGXRAY        public static string GetUSINGXRAYSIdString(otsdataconst.OTS_USING_X_RAY a_nUSINGXRAY)        {            string strUSINGXRAY = "";                           strUSINGXRAY = XmlResourceData.GetInstance().GetStringByKey(ResourceID.GrpMeasureResult, ResourceID.IDS_USINGXRAYS + (int)a_nUSINGXRAY);                       return strUSINGXRAY;        }        public static string GetSourceTitleString(OTS_SAMPLE_PROP_GRID_ITEM_GROUPS rowIndex)        {            string strSourceName = "";                            strSourceName = XmlResourceData.GetInstance().GetGroupTextByKey((int)rowIndex);                       return strSourceName;        }        public static string GetSourceColNameString(int resourceGrp, int rowIndex)        {            string strSourceName = "";            strSourceName = XmlResourceData.GetInstance().GetStringByKey(resourceGrp, rowIndex);            return strSourceName;        }        public static string GetResourceByKey(int resourceGrp, int Index)        {                        string strSource = XmlResourceData.GetInstance().GetStringByKey(resourceGrp, Index);            return strSource;        }    }}
 |