瀏覽代碼

add untracked files

gsp 1 年之前
父節點
當前提交
9121381d9e

+ 61 - 0
OTSIncAMeasureApp/3-OTSDisplaySourceGridData/CPropItem.cs

@@ -0,0 +1,61 @@
+using OTSModelSharp.ResourceManage;
+using System;
+using System.Collections.Generic;
+namespace OTSMeasureApp
+{
+
+
+    public class CPropItem
+    {
+        private OTS_SAMPLE_PROP_GRID_ITEMS iSampleId;            //样品属性ID
+        private String sSCaptionName;    //样品标题名                             
+        private OTS_ITEM_TYPES iSampleValType;      //样品标题名对应值的类型
+        private Object sampleVal="";        //样品标题名对应值,全部是string
+        public List<String> comboDownList = new List<string>();//如果iSampleValType是combobox则在此处存储下拉列表  
+        public bool bReadOnly;          //值的类型
+        private string sDescriptionInfo;   //描述信息
+
+        public OTS_SAMPLE_PROP_GRID_ITEMS SampleId { get => iSampleId; set => iSampleId = value; }
+        public string CaptionName { get => sSCaptionName; set => sSCaptionName = value; }
+        public OTS_ITEM_TYPES SampleValType { get => iSampleValType; set => iSampleValType = value; }
+
+        public object GetSampleVal()
+        {
+
+            return sampleVal;
+        }
+
+        public void SetSampleVal(object value)
+        {
+            sampleVal = value;
+        }
+
+        public string Description { get => sDescriptionInfo; set => sDescriptionInfo = value; }
+
+        public void InitialSmplParameter(OTS_SAMPLE_PROP_GRID_ITEM_GROUPS GROUPS, OTS_SAMPLE_PROP_GRID_ITEMS a_nSmplId, OTS_ITEM_TYPES a_nType, bool a_bReadOnly, bool a_bShow)
+        {
+         
+            var strRes = ResourceData.GetStringResourceByKey(GROUPS, a_nSmplId);
+            if (a_nType == OTS_ITEM_TYPES.COMBO)
+            {
+                comboDownList = strRes.combolist;
+            }
+            
+            sSCaptionName = strRes.text;
+            sDescriptionInfo = strRes.Description;
+            iSampleId = a_nSmplId;
+            iSampleValType = a_nType;
+            bReadOnly = a_bReadOnly;
+
+        }
+
+    }
+
+
+
+
+
+
+
+}
+

+ 47 - 0
OTSIncAMeasureApp/3-OTSDisplaySourceGridData/CPropItemGrp.cs

@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using OTSModelSharp.ResourceManage;
+namespace OTSMeasureApp
+{
+    public class CPropItemGrp              //样品信息
+    {
+        private OTS_SAMPLE_PROP_GRID_ITEM_GROUPS groupId;
+        private String sTitle;              //样品名称
+
+
+        private List<CPropItem> sampleDataList = new List<CPropItem>();   //样品属性数据
+
+        public List<CPropItem> GetSampleDataList()
+        {
+            return sampleDataList;
+        }
+
+        public void SetSampleDataList(List<CPropItem> value)
+        {
+            sampleDataList = value;
+        }
+
+        public OTS_SAMPLE_PROP_GRID_ITEM_GROUPS GetGroupId()
+        {
+            return groupId;
+        }
+
+        public void SetGroupId(OTS_SAMPLE_PROP_GRID_ITEM_GROUPS value)
+        {
+            groupId = value;
+        }
+
+        public string GetSTitle()
+        {
+            return sTitle;
+        }
+
+        public void SetSTitle(string value)
+        {
+            sTitle = value;
+        }
+    }
+}

+ 2223 - 0
OTSIncAMeasureApp/3-OTSDisplaySourceGridData/OTSSampleVisualPropertyInfo.cs

@@ -0,0 +1,2223 @@
+using OTSDataType;
+using static OTSModelSharp.ResourceManage.ResourceID;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using static OTSDataType.otsdataconst;
+using OTSModelSharp.ResourceManage;
+using OTSModelSharp;
+using System.IO;
+
+namespace OTSMeasureApp
+{
+    public enum OTS_ITEM_TYPES
+    {
+        INVALID = -1,
+
+        BOOL = 0,
+        INT = 1,
+        DOUBLE = 2,
+        STRING = 3,
+        COMBO = 4,
+        TIME = 5,
+        TIME_SPAN = 6
+      
+
+    }
+    public class CTreeSampleParam
+    {
+        public string sSampleTitleName;   //样品树显示的样品标题名称
+        public string sWorkSampleName;    // 工作样品名称
+        public bool bSwitch;             //样品执行开关
+      
+    };
+
+    public struct SampleMeasurePara
+    {
+
+        public string sSampleName;
+        public string sampleHoleName;
+        public ShapeType iShape;   //测量区域形状                                
+                              
+        public List<PointF> DrawPolygonPointList;//多边形点集合
+        public RectangleF MeasureRect;      //测量区域大小
+    };
+
+    //样品属性数据
+   
+
+   
+
+    public class OTSSampleVisualPropertyInfo
+    {
+        const string NOT_APPLIED = "N/A";
+        COTSSample m_Sample;
+        private List<CPropItemGrp> m_listPropItemGrp;
+        private List<CPropItem> sampleDataList;//保持一个所有条目列表,目的为了兼容以前的代码
+        private OTS_SysType_ID m_systype;
+        //构造函数
+        public OTSSampleVisualPropertyInfo(COTSSample WSample,OTS_SysType_ID systype)
+        {
+            m_Sample = WSample;
+            m_systype = systype;
+
+            SMeasurePara = new SampleMeasurePara();
+            SampleDataList = new List<CPropItem>();
+            TSampleParam = new CTreeSampleParam();
+
+      
+            m_listPropItemGrp = new List<CPropItemGrp>();
+            InitPropItemGrps();
+            UpdatePropertyData();
+
+        }
+        public void InitPropItemGrps()
+        {
+            this.ClearGrp();
+            //设置工作样品属性项
+
+            if (m_systype == OTS_SysType_ID.CleannessA)
+            {
+               SetPropItemGrpsWithOutIncASysLib();
+            }
+            else if (m_systype == OTS_SysType_ID.IncA)
+            {
+               SetPropItemGrpsForIncA();
+            }
+
+
+            //样品的标题名 (Treeview的根节点名)           
+            this.sSampleSoluName = m_Sample.GetName();//.GetFileName();
+
+            // Treeview 的样品信息  
+            TSampleParam.sSampleTitleName = m_Sample.GetName();
+
+            //获得 样品属性值
+
+
+
+            bSwitch = m_Sample.GetSwitch();
+
+
+            SMeasurePara.sSampleName = m_Sample.GetName();
+            // 获取测量区域形状
+            SMeasurePara.iShape = (ShapeType)m_Sample.GetMsrDomain().GetShape();
+            //获取样品孔名称
+            SMeasurePara.sampleHoleName = m_Sample.GetSampleHoleName();
+
+            RectangleF rec = m_Sample.GetMsrDomain().GetDomainRect();
+            SMeasurePara.MeasureRect = new Rectangle((int)rec.X, (int)rec.Y, (int)rec.Width, (int)rec.Height);
+
+
+            TSampleParam.sWorkSampleName = m_Sample.GetName();
+            TSampleParam.bSwitch = m_Sample.GetSwitch();
+
+
+
+
+            return;
+        }
+        public bool GetPropBOOLData(int a_nId, out bool a_bValue)
+        {
+            var m_poMsrParams = m_Sample.GetMsrParams();
+            switch (a_nId)
+            {
+                case (int)OTS_SAMPLE_PROP_GRID_ITEMS.SWITCH:
+                    {
+                        a_bValue = m_Sample.GetSwitch() ;
+                    }
+                    break;
+                case (int)OTS_SAMPLE_PROP_GRID_ITEMS.SYS_STD_SWITCH:
+                    {
+                        a_bValue = m_poMsrParams.GetSysSTDSwitch();
+                    }
+                    break;
+                case (int)OTS_SAMPLE_PROP_GRID_ITEMS.USING_XRAY:
+                    {
+                        a_bValue = m_poMsrParams.GetXRayParam().GetUsingXray();
+                    }
+                    break;
+                default:
+                    {
+                        a_bValue = false;
+                        // something wrong, return FALSE
+                        return false;
+                    }
+                    break;
+
+            }
+
+            // ok, return TRUE
+            return true;
+        }
+
+        public bool GetPropIntData(OTS_SAMPLE_PROP_GRID_ITEMS a_nId, out int a_nValue)
+        {
+            var m_poMsrParams = m_Sample.GetMsrParams();
+            var m_poSEMDataMsr = m_Sample.GetSEMDataMsr();
+            var m_Status = m_Sample.GetMsrStatus();
+            var m_poMsrResults = m_Sample.GetMsrResults();
+
+            switch (a_nId)
+            {
+                case OTS_SAMPLE_PROP_GRID_ITEMS.STOP_PARAM_PARTICLE:
+                    {
+                        a_nValue = m_poMsrParams.GetImageScanParam().GetStopParamParticles();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.STOP_PARAM_FIELD:
+                    {
+                        a_nValue = m_poMsrParams.GetImageScanParam().GetStopParamFields();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.STOP_PARAM_TIME:
+                    {
+                        a_nValue = m_poMsrParams.GetImageScanParam().GetStopParamMeasTime();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.STOP_PARAM_AREA:
+                    {
+                        a_nValue = m_poMsrParams.GetImageScanParam().GetStopParamArea();
+                    }
+                    break;
+
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.BG_GRAY_MIN:
+                    {
+                        a_nValue = m_poMsrParams.GetImageProcessParam().GetBGGray().GetStart();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.BG_GRAY_MAX:
+                    {
+                        a_nValue = m_poMsrParams.GetImageProcessParam().GetBGGray().GetEnd();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_GRAY_MIN:
+                    {
+                        a_nValue = m_poMsrParams.GetImageProcessParam().GetParticleGray().GetStart();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_GRAY_MAX:
+                    {
+                        a_nValue = m_poMsrParams.GetImageProcessParam().GetParticleGray().GetEnd();
+                    }
+                    break;
+
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.ANALYSIS_COUNTS:
+                    {
+                        a_nValue = m_poMsrParams.GetXRayParam().GetAnalyExpCount();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.ANALYSIS_RESOLUTION:
+                    {
+                        a_nValue = (int)m_poMsrParams.GetXRayParam().GetMidAnalyAQTime();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_FIELDS:
+                    {
+                        a_nValue = m_poSEMDataMsr.GetTotalFields();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.COMPLETED_FIELDS:
+                    {
+                        a_nValue = m_Status.GetCompletedFields();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_PARTICLE:
+                    {
+                        a_nValue = (int)m_poMsrResults.GetTotalParticleNumber();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.XRAY_FASTTIME:
+                    {
+                        a_nValue = m_poMsrParams.GetXRayParam().GetFastXrayTime();
+                    }
+                    break;
+                case OTS_SAMPLE_PROP_GRID_ITEMS.XrayLimit:
+                    {
+                        a_nValue = m_poMsrParams.GetXRayParam().GetXrayLimit();
+                    }
+                    break;
+                default:
+                    {
+                        // something wrong, return false
+                        a_nValue = -1;
+                        return false;
+                    }
+
+
+            }
+
+
+            return true;
+        }
+        //样品属性数据
+        public bool SetParamVal(OTS_SAMPLE_PROP_GRID_ITEMS ItemId, OTS_ITEM_TYPES ValType, object objVal)
+        {
+            var m_poMsrParams = m_Sample.GetMsrParams();
+            var m_poSEMDataMsr = m_Sample.GetSEMDataMsr();
+            var m_Status = m_Sample.GetMsrStatus();
+            var m_poMsrResults = m_Sample.GetMsrResults();
+            var logstr = "set value " + ItemId.ToString() + "=" + objVal.ToString();
+            NLog.LogManager.GetCurrentClassLogger().Warn(logstr);
+
+            bool bSetFalg = true;
+
+            switch (ItemId)
+            {
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.SWITCH:
+                    {
+                        m_Sample.SetSwitch((bool)objVal);
+                    }
+                    break;
+                case OTS_SAMPLE_PROP_GRID_ITEMS.SYS_STD_SWITCH:
+                    {
+                        m_poMsrParams.SetSysSTDSwitch((bool)objVal);
+                    }
+                    break;
+                case OTS_SAMPLE_PROP_GRID_ITEMS.USING_XRAY:
+                    {
+
+
+                        m_poMsrParams.GetXRayParam().SetUsingXray((bool)objVal);
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.STOP_PARAM_PARTICLE:
+                    {
+                        // value validation
+                        if (STOP_PARAM_PARTICLE_MIN >= (int)objVal || (int)objVal > STOP_PARAM_PARTICLE_MAX)
+                        {
+                            return false;
+                        }
+
+                        if (m_poMsrParams.GetImageScanParam().GetStopParamParticles() != (int)objVal)
+                        {
+                            m_poMsrParams.GetImageScanParam().SetStopParamParticles((int)objVal);
+                            m_Status.SetStatus(OTS_MSR_SAMPLE_STATUS.UNMEASURED);
+                        }
+
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.STOP_PARAM_FIELD:
+                    {
+                        if (STOP_PARAM_FIELD_MIN >= (int)objVal || (int)objVal > STOP_PARAM_FIELD_MAX)
+                        {
+                            return false;
+                        }
+
+                        if (m_poMsrParams.GetImageScanParam().GetStopParamFields() != (int)objVal)
+                        {
+                            m_poMsrParams.GetImageScanParam().SetStopParamFields((int)objVal);
+                            m_Status.SetStatus(OTS_MSR_SAMPLE_STATUS.UNMEASURED);
+                        }
+
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.STOP_PARAM_TIME:
+                    {
+                        if (STOP_PARAM_MSR_TINE_MIN >= (int)objVal || (int)objVal > STOP_PARAM_MSR_TINE_MAX)
+                        {
+                            return false;
+                        }
+
+                        if (m_poMsrParams.GetImageScanParam().GetStopParamMeasTime() != (int)objVal)
+                        {
+                            m_poMsrParams.GetImageScanParam().SetStopParamMeasTime((int)objVal);
+                            m_Status.SetStatus(OTS_MSR_SAMPLE_STATUS.UNMEASURED);
+                        }
+
+                    }
+                    break;
+                case OTS_SAMPLE_PROP_GRID_ITEMS.STOP_PARAM_AREA:
+                    {
+                        if (STOP_PARAM_MSR_TINE_MIN >= (int)objVal || (int)objVal > STOP_PARAM_FIELD_MAX)
+                        {
+                            return false;
+                        }
+
+                        if (m_poMsrParams.GetImageScanParam().GetStopParamArea() != (int)objVal)
+                        {
+                            m_poMsrParams.GetImageScanParam().SetStopParamArea((int)objVal);
+                            m_Status.SetStatus(OTS_MSR_SAMPLE_STATUS.UNMEASURED);
+                        }
+
+                    }
+                    break;
+                case OTS_SAMPLE_PROP_GRID_ITEMS.BG_GRAY_MIN:
+                    {
+                        if (GRAY_LEVEL_MIN > (int)objVal || (int)objVal > GRAY_LEVEL_MAX)
+                        {
+                            return false;
+                        }
+
+                        if (m_poMsrParams == null)
+                        {
+                            return false;
+                        }
+
+                        COTSImageProcParam pImageProcessParam = m_poMsrParams.GetImageProcessParam();
+                        if (pImageProcessParam == null)
+                        {
+                            return false;
+                        }
+
+                        CIntRange oBGGray = m_poMsrParams.GetImageProcessParam().GetBGGray();
+                        oBGGray.SetStart((int)objVal);
+                        m_poMsrParams.GetImageProcessParam().SetBGGray(oBGGray);
+
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.BG_GRAY_MAX:
+                    {
+                        if (GRAY_LEVEL_MIN > (int)objVal || (int)objVal > GRAY_LEVEL_MAX)
+                        {
+                            return false;
+                        }
+
+                        CIntRange oBGGray = m_poMsrParams.GetImageProcessParam().GetBGGray();
+                        oBGGray.SetEnd((int)objVal);
+                        m_poMsrParams.GetImageProcessParam().SetBGGray(oBGGray);
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_GRAY_MIN:
+                    {
+                        if (GRAY_LEVEL_MIN > (int)objVal || (int)objVal > GRAY_LEVEL_MAX)
+                        {
+                            return false;
+                        }
+                        CIntRange oParticleGray = m_poMsrParams.GetImageProcessParam().GetParticleGray();
+                        oParticleGray.SetStart((int)objVal);
+                        m_poMsrParams.GetImageProcessParam().SetParticleGray(oParticleGray);
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_GRAY_MAX:
+                    {
+                        if (GRAY_LEVEL_MIN > (int)objVal || (int)objVal > GRAY_LEVEL_MAX)
+                        {
+                            return false;
+                        }
+                        CIntRange oParticleGray = m_poMsrParams.GetImageProcessParam().GetParticleGray();
+                        oParticleGray.SetEnd((int)objVal);
+                        m_poMsrParams.GetImageProcessParam().SetParticleGray(oParticleGray);
+                    }
+                    break;
+
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.ANALYSIS_COUNTS:
+                    {
+                        if (COUNTS_MIN > (int)objVal)
+                        {
+                            return false;
+                        }
+                        m_poMsrParams.GetXRayParam().SetAnalyExpCount((int)objVal);
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.ANALYSIS_RESOLUTION:
+                    {
+                        if (0 >= (int)objVal)
+                        {
+                            return false;
+                        }
+                        m_poMsrParams.GetXRayParam().SetMidAnalyAQTime((int)objVal);
+                    }
+                    break;
+                
+                case OTS_SAMPLE_PROP_GRID_ITEMS.XRAY_FASTTIME:
+                    {
+                        if (0 >= (int)objVal)
+                        {
+                            return false;
+                        }
+                        m_poMsrParams.GetXRayParam().SetFastXrayTime((int)objVal);
+                    }
+                    break;
+                case OTS_SAMPLE_PROP_GRID_ITEMS.XrayLimit:
+                    {
+                        if (0 >= (int)objVal)
+                        {
+                            return false;
+                        }
+                        m_poMsrParams.GetXRayParam().SetXrayLimit((int)objVal);
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_FIELDS:
+                case OTS_SAMPLE_PROP_GRID_ITEMS.COMPLETED_FIELDS:
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_PARTICLE:
+
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.MAGNIFICATION:
+                    {
+                        // value validation
+                        if ((double)objVal < MAGNIFICATION_MIN || (double)objVal > MAGNIFICATION_MAX)
+                        {
+                            return false;
+                        }
+                        m_poSEMDataMsr.SetMagnification((double)objVal);
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.IMAGERESOLUTION_SIZE:
+                    {
+                        if ((double)objVal < RESOLUTION_MIN || (double)objVal > RESOLUTION_MAX)
+                        {
+                            return false;
+                        }
+
+
+
+                        int nScanFieldSize = 0;
+                        int nScanFieldHeight = 0;
+                        m_Sample.CalculateScanFieldSize((double)objVal, ref nScanFieldSize, ref nScanFieldHeight);
+
+                        m_poSEMDataMsr.SetScanFieldWidth(nScanFieldSize);
+                        m_poSEMDataMsr.SetScanFieldHeight(nScanFieldHeight);
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_AREA_MIN:
+                    {
+                        if (PARTICLE_AREA_MIN > (double)objVal || (double)objVal > PARTICLE_AREA_MAX)
+                        {
+                            return false;
+                        }
+
+                        CDoubleRange oIncArea = new CDoubleRange();
+                        double start = m_poMsrParams.GetImageProcessParam().GetIncAreaRange().GetStart();
+                        double end = m_poMsrParams.GetImageProcessParam().GetIncAreaRange().GetEnd();
+                        oIncArea.SetStart((double)objVal);
+                        oIncArea.SetEnd(end);
+                        m_poMsrParams.GetImageProcessParam().SetIncAreaRange(oIncArea);
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_AREA_MAX:
+                    {
+                        if (PARTICLE_AREA_MIN > (double)objVal || (double)objVal > PARTICLE_AREA_MAX)
+                        {
+                            return false;
+                        }
+                        CDoubleRange oIncArea = new CDoubleRange();
+                        double start = m_poMsrParams.GetImageProcessParam().GetIncAreaRange().GetStart();
+                        double end = m_poMsrParams.GetImageProcessParam().GetIncAreaRange().GetEnd();
+                        oIncArea.SetStart(start);
+                        oIncArea.SetEnd((double)objVal);
+                        m_poMsrParams.GetImageProcessParam().SetIncAreaRange(oIncArea);
+                    }
+                    break;
+                case OTS_SAMPLE_PROP_GRID_ITEMS.XRAY_QUANTIFY_MINSIZE:
+                    {
+                        if (0 >= (double)objVal)
+                        {
+                            return false;
+                        }
+                        m_poMsrParams.GetXRayParam().SetQuantifyMinSize((double)objVal);
+                    }
+                    break;
+
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.WORKING_DISTANCE:
+                case OTS_SAMPLE_PROP_GRID_ITEMS.RATIO:
+                case OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_TO_MEASURE_AREA:
+                case OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_AREA:
+                case OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_PARTICLE_AREA:
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.SAMPLE_NAME:
+                    {
+                        string m_strName=m_Sample.GetName();
+                        //we think the samplename as the Identification of the sample,if we change the name then reset the status.
+                        //so we can remeasure the sample by change the sample name.
+                        if (m_strName != (string)objVal)
+                        {
+                            m_strName = (string)objVal;
+                            m_Status = new CMsrSampleStatus();
+                        }
+                        m_Sample.SetName(m_strName);
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.STOP_MODE:
+                    {
+                        if (m_poMsrParams.GetImageScanParam().GetStopMode() != (string)objVal)
+                        {
+                            m_poMsrParams.GetImageScanParam().SetStopMode((string)objVal);
+                        }
+                    }
+                    break;
+
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.SAMPLE_HOLE_NAME:
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.MEASURE_STATAU:
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.STEEL_TECHNOLOGY:
+                    {
+                        if (STEEL_TECHNOLOGY.GeneralProcessMode > (STEEL_TECHNOLOGY)(int)objVal || (STEEL_TECHNOLOGY)(int)objVal > STEEL_TECHNOLOGY.RareEarthMode)
+                        {
+                            return false;
+                        }
+
+                        m_poMsrParams.SetSteelTechnology((STEEL_TECHNOLOGY)(int)objVal);
+                    }
+                    break;
+                case OTS_SAMPLE_PROP_GRID_ITEMS.START_PHOTO_MODE:
+                    {
+                        if (OTS_GET_IMAGE_MODE.FROM_CENTER > (OTS_GET_IMAGE_MODE)(int)objVal || (OTS_GET_IMAGE_MODE)(int)objVal > OTS_GET_IMAGE_MODE.DOWN_TO_UP)
+                        {
+                            return false;
+                        }
+
+                        m_poMsrParams.GetImageScanParam().SetStartImageMode((OTS_GET_IMAGE_MODE)(int)objVal);
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.SCAN_SPEED:
+                    {
+                        if (OTS_IMAGE_SCANSPEED_OPTIONS.low > (OTS_IMAGE_SCANSPEED_OPTIONS)(int)objVal || (OTS_IMAGE_SCANSPEED_OPTIONS)(int)objVal > OTS_IMAGE_SCANSPEED_OPTIONS.high)
+                        {
+                            return false;
+                        }
+                        m_poMsrParams.GetImageScanParam().SetScanImageSpeed((OTS_IMAGE_SCANSPEED_OPTIONS)(int)objVal);
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.IMAGE_RESOLUTION:
+                    {
+                        if (OTS_IMAGE_RESULOTION_OPTIONS._512_384 > (OTS_IMAGE_RESULOTION_OPTIONS)(int)objVal || (OTS_IMAGE_RESULOTION_OPTIONS)(int)objVal > OTS_IMAGE_RESULOTION_OPTIONS._4096_3072)
+                        {
+                            return false;
+                        }
+                        m_poMsrParams.GetImageScanParam().SetImageResulotion((OTS_IMAGE_RESULOTION_OPTIONS)(int)objVal);
+                    }
+                    break;
+
+              
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.XRAYSCAN_MODE:
+                    {
+                        if (OTS_X_RAY_SCAN_MODE.PointMode > (OTS_X_RAY_SCAN_MODE)(int)objVal || (OTS_X_RAY_SCAN_MODE)(int)objVal > OTS_X_RAY_SCAN_MODE.FeatureMode)
+                        {
+                            return false;
+                        }
+                        m_poMsrParams.GetXRayParam().SetScanMode((OTS_X_RAY_SCAN_MODE)(int)objVal);
+                    }
+                    break;
+                case OTS_SAMPLE_PROP_GRID_ITEMS.MEMBRANE_TYPE:
+                    {
+                        if (MEMBRANE_TYPE.MIN > (MEMBRANE_TYPE)(int)objVal || (MEMBRANE_TYPE)(int)objVal > MEMBRANE_TYPE.MAX)
+                        {
+                            return false;
+                        }
+                        m_Sample.SetMembraneType((MEMBRANE_TYPE)(int)objVal);
+                    }
+                    break;
+               
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.BGREMOVE_TYPE:
+                    {
+
+                        m_poMsrParams.GetImageProcessParam().SetBGRemoveType((OTS_BGREMOVE_TYPE)(int)objVal);
+                    }
+                    break;
+                case OTS_SAMPLE_PROP_GRID_ITEMS.AUTOBGREMOVE_TYPE:
+                    {
+
+                        m_poMsrParams.GetImageProcessParam().SetAutoBGRemoveType((OTS_AUTOBGREMOVE_TYPE)(int)objVal);
+                    }
+                    break;
+
+                default:
+
+                    bSetFalg = false;
+                    break;
+            }
+            if (bSetFalg)
+            {
+                m_Sample.GetMsrStatus().SetStatus(OTS_MSR_SAMPLE_STATUS.UNMEASURED);//change the state so that this sample can be processed again.
+            }
+
+            return bSetFalg;
+        }
+        // get std file list, a_nPos = -1, current do not use any STD lib, a_nPos = 0, current use STD lib.
+        private bool GetSTDFileList(ref int a_nPos, ref List<String> a_listSTDLibName)
+        {
+
+            String a_strFolderName = COTSDefaultParam.GetPartSTDLibFolderName();
+
+
+            if (a_strFolderName == "")
+            {
+
+                return false;
+            }
+
+            // lib name list
+            a_listSTDLibName.Clear();
+
+            // file list
+            List<String> listSTDFile = new List<string>();
+            listSTDFile.Clear();
+            const String STD_LIB_EXT = ".db";
+            // get file list
+            if (!GetFileNameList(a_strFolderName, STD_LIB_EXT, listSTDFile))
+            {
+
+                return false;
+            }
+
+            foreach (var file in listSTDFile)
+            {
+                
+               
+                a_listSTDLibName.Add(file);
+            }
+            a_listSTDLibName.Add("NoSTDDB");
+
+
+            //before the use choose one STD, always should be null.
+            a_nPos = -1;
+
+            String sCurrentSTD;
+            CSampleParam pCurrentParam;
+            COTSSample pSample = m_Sample;
+           
+                pCurrentParam = pSample.GetMsrParams();
+                
+
+                //将当前使用的数据库的名字与下拉菜单的名字对应起来
+                sCurrentSTD = pCurrentParam.GetSTDName();
+                for (int i = 0; i < (int)a_listSTDLibName.Count; i++)
+                {
+                    a_nPos++;
+                    if (a_listSTDLibName[i].CompareTo(sCurrentSTD) == 0)
+                        break;
+                }
+
+           
+
+            return true;
+        }
+
+        // get file name list in a folder
+        private bool GetFileNameList(String a_strFolderName, String a_strFileType, List<String> a_listFileName)
+        {
+
+            try
+            {
+
+                string path = a_strFolderName;
+                List<string> lineStringList = new List<string>();//存储所有读取到的文件
+                DirectoryInfo[] dateDirArr = new DirectoryInfo(path).GetDirectories(); //取指定路径下的所有目录
+
+                string[] dir = Directory.GetDirectories(path); //文件夹列表   
+                DirectoryInfo fdir = new DirectoryInfo(path);
+                FileInfo[] files = fdir.GetFiles();
+                foreach (FileInfo file in files)
+                {
+                    string extensionName = Path.GetExtension(file.FullName);
+                    if (extensionName == a_strFileType)
+                    {
+                        string FileNameWithoutExtension = Path.GetFileNameWithoutExtension(file.FullName);
+                        a_listFileName.Add(FileNameWithoutExtension);
+                    }
+                }
+
+            }
+            catch (Exception pe)
+            {
+                
+                return false;
+            }
+
+            return true;
+
+        }
+        private bool ChangeSTDFromList(int a_nPos)
+        {
+
+
+            String a_strFolderName = COTSDefaultParam.GetPartSTDLibFolderName();
+            if (a_strFolderName == "")
+            {
+                return false;
+            }
+
+            // file list
+            List<String> listSTDFile = new List<string>();
+            listSTDFile.Clear();
+            const String STD_LIB_EXT = ".db";
+            // get file list
+            if (!GetFileNameList(a_strFolderName, STD_LIB_EXT, listSTDFile))
+            {
+
+                return false;
+            }
+
+            List<String> listSTDLibName = new List<string>();
+            listSTDLibName.Clear();
+
+            foreach (var file in listSTDFile)
+            {
+                //string fileName = file.Left(file.GetLength() - 3);
+                String fileName = file;
+                listSTDLibName.Add(fileName);
+            }
+
+            if (a_nPos > (int)listSTDLibName.Count)
+            {
+                return false;
+            }
+            String STDName = listSTDLibName[a_nPos];
+
+            // updata STD to working sample
+            COTSSample pSample = m_Sample;
+
+
+            CSampleParam pParam = pSample.GetMsrParams();
+
+            pParam.SetSTDName(STDName);
+            pSample.SetMsrParams(pParam);
+
+            return true;
+
+        }
+        public bool SetPropItemGrpsForIncA()
+        {
+            var m_poMsrParams = m_Sample.GetMsrParams();
+            var m_poSEMDataMsr = m_Sample.GetSEMDataMsr();
+            var m_Status = m_Sample.GetMsrStatus();
+            var m_poMsrResults = m_Sample.GetMsrResults();
+
+            if (m_listPropItemGrp != null)
+            {
+                if (m_listPropItemGrp.Count > 0)
+                {
+                    m_listPropItemGrp.Clear();
+                }
+            }
+            // property items group
+            OTS_SAMPLE_PROP_GRID_ITEM_GROUPS a_nId;
+            for (int i = (int)OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.MIN; i <= (int)OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.MAX; i++)
+            {
+
+                // items list
+                List<CPropItem> a_listPropItems = new List<CPropItem>();
+                a_nId = (OTS_SAMPLE_PROP_GRID_ITEM_GROUPS)i;
+                if (m_poMsrParams.m_runmode == RunMode.PlainMode)
+                {
+                    if (a_nId != OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.GENERAL)
+                    {
+                        break;//if it's plainmode then only display the general parameter section.
+                    }
+
+                }
+
+
+
+                CPropItemGrp poPropItemGrp = new CPropItemGrp();
+                // property items group name
+                string strGrpName = string.Empty;
+                strGrpName = ResourceData.GetSourceTitleString((OTS_SAMPLE_PROP_GRID_ITEM_GROUPS)a_nId);
+                //if (strGrpName == "")
+                //{
+                //    return false;
+                //}
+                // group name and id
+                poPropItemGrp.SetSTitle(strGrpName);
+                poPropItemGrp.SetGroupId(a_nId);
+                // set group items list
+                OTS_SAMPLE_PROP_GRID_ITEMS nItemId;
+                CPropItem poPropItem;
+                bool bShow = true;
+                //分组编号
+                //int a_nId = ResourceID.GrpGeneral;
+                switch (a_nId)
+                {
+                    case OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.GENERAL:
+                        {
+                            //a_nId = ResourceID.GrpGeneral;
+                            // name
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.SAMPLE_NAME;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.STRING, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            // hole
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.SAMPLE_HOLE_NAME;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.STRING, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            // switch
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.SWITCH;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.BOOL, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            // system STD
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.SYS_STD_SWITCH;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.BOOL, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+
+
+                            // STD file name
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.STD_FILE_NAME;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.COMBO, false, bShow);
+                            int val = 0;
+                            List<string> comboDownlist = new List<string>();
+                            GetSTDFileList(ref val, ref comboDownlist);
+                            poPropItem.comboDownList = comboDownlist;
+                            poPropItem.SetSampleVal(val);
+                            a_listPropItems.Add(poPropItem);
+                          
+
+                            // Steel technology
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.STEEL_TECHNOLOGY;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.COMBO, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+                        }
+                        break;
+
+                    case OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.IMAGESCAN:
+                        {
+                            //a_nId = ResourceID.GrpImageScan;
+                            // start mode
+                            COTSImgScanPrm pScanParam = m_poMsrParams.GetImageScanParam();
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.START_PHOTO_MODE;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.COMBO, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            //// stop mode
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.STOP_MODE;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.STRING, true, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            //// stop parameter
+
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.STOP_PARAM_PARTICLE;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, true, false);
+                            a_listPropItems.Add(poPropItem);
+
+                            // field
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.STOP_PARAM_FIELD;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, true, false);
+                            a_listPropItems.Add(poPropItem);
+
+                            // used time
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.STOP_PARAM_TIME;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, true, false);
+                            a_listPropItems.Add(poPropItem);
+
+                            // area
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.STOP_PARAM_AREA;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, true, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            // scan speed
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.SCAN_SPEED;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.COMBO, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            // image resolution
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.IMAGE_RESOLUTION;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.COMBO, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                        }
+                        break;
+
+                    case OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.IMAGE_PROCESS:
+                        {
+                            //a_nId = ResourceID.GrpImageProcess;
+                            COTSImageProcParam pProcParam = m_poMsrParams.GetImageProcessParam();
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.BGREMOVE_TYPE;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.COMBO, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            switch (m_poMsrParams.GetImageProcessParam().GetBGRemoveType())
+                            {
+                                case OTS_BGREMOVE_TYPE.AUTO:
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.AUTOBGREMOVE_TYPE;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.COMBO, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+                                    // particle area min
+
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_AREA_MIN;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+
+                                    // particle area max
+
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_AREA_MAX;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+
+                                    break;
+                                case OTS_BGREMOVE_TYPE.MANUAL:
+
+
+                                    // BG gray level min
+
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.BG_GRAY_MIN;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+
+                                    // BG gray level max
+
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.BG_GRAY_MAX;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+                                    //---------------------------------------
+                                    // particle gray level min
+
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_GRAY_MIN;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+
+                                    // particle gray level max
+
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_GRAY_MAX;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+                                    //----------------------------------------
+
+                                    // particle area min
+
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_AREA_MIN;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+
+                                    // particle area max
+
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_AREA_MAX;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+
+
+
+                                    break;
+
+                            }
+                        }
+                        break;
+
+                    case OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.XRAY:
+                        {
+                            
+
+                            // UsingXray
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.USING_XRAY;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.BOOL, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+
+                            //quantify size
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.XRAY_QUANTIFY_MINSIZE;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+                            // scan mode 
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.XRAYSCAN_MODE;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.COMBO, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            // analysis 
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.ANALYSIS_RESOLUTION;//big particle AQTime
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+                            //fast xray time.
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.XRAY_FASTTIME;//small particle AQTime
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+                            // analysis counts 
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.ANALYSIS_COUNTS;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            // XrayLimit 
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.XrayLimit;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                        }
+                        break;
+                    case OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.SEM:
+                        {
+                            //a_nId = ResourceID.GrpSEMParameter;
+                            // does SEM data (measure) set?
+                            CSEMDataMsr m_TempSEMDataMsr = new CSEMDataMsr();
+                            if ((m_poSEMDataMsr.GetScanFieldSize100() == m_TempSEMDataMsr.GetScanFieldSize100())
+                                && (m_poSEMDataMsr.GetTotalFields() == m_TempSEMDataMsr.GetTotalFields())
+                                && (m_poSEMDataMsr.GetWorkingDistance() == m_TempSEMDataMsr.GetWorkingDistance())
+                                && (m_poSEMDataMsr.GetScanFieldSize() == m_TempSEMDataMsr.GetScanFieldSize()))
+                            {
+                                // magnification
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.MAGNIFICATION;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.STRING, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // pixel size
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.IMAGERESOLUTION_SIZE;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.STRING, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // working distance
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.WORKING_DISTANCE;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.STRING, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // total field
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_FIELDS;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.STRING, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // total area
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_TO_MEASURE_AREA;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, true, true);
+                                a_listPropItems.Add(poPropItem);
+                            }
+                            else
+                            {
+                                // magnification
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.MAGNIFICATION;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, false, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // pixel size
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.IMAGERESOLUTION_SIZE;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, false, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // working distance
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.WORKING_DISTANCE;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // total field
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_FIELDS;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // total area
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_TO_MEASURE_AREA;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, true, true);
+                                a_listPropItems.Add(poPropItem);
+                            }
+                        }
+                        break;
+
+                    case OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.MEASURE_STATUS:
+                        {
+                            //a_nId = ResourceID.GrpMeasureState;
+                            // measure status 
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.MEASURE_STATAU;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.STRING, true, true);
+                            a_listPropItems.Add(poPropItem);
+
+                            // has measure result?
+                            if (m_Sample. HasMeasureResult())
+                            {
+                                // start time 
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.START_TIME;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.TIME, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // used time 
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.USED_TIME;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.TIME_SPAN, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // finish time 
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.FINISH_TIME;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.TIME, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // completed fields 
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.COMPLETED_FIELDS;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, true, true);
+                                a_listPropItems.Add(poPropItem);
+                            }
+                        }
+                        break;
+
+                    case OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.MEASURE_RESULTS:
+                        {
+                            //a_nId = ResourceID.GrpMeasureResult;
+                            // has measure result?
+                            if (m_Sample. HasMeasureResult())
+                            {
+
+                                // radio 
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.RATIO;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // total measured area 
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_AREA;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // total particles 
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_PARTICLE;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // total particle area
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_PARTICLE_AREA;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, true, true);
+                                a_listPropItems.Add(poPropItem);
+                            }
+                        }
+                        break;
+
+                    default:
+                        {
+                            // something wrong here, return nullptr
+                            break;
+                        }
+                }
+                poPropItemGrp.SetSampleDataList(a_listPropItems);
+                this.AddASampleDataGrp(poPropItemGrp);
+            }
+            // return property items group
+            return true; ;
+        }
+        public bool SetPropItemGrpsWithOutIncASysLib()
+        {
+            var m_poMsrParams = m_Sample.GetMsrParams();
+            var m_poSEMDataMsr = m_Sample.GetSEMDataMsr();
+            var m_Status = m_Sample.GetMsrStatus();
+            var m_poMsrResults = m_Sample.GetMsrResults();
+            if (m_listPropItemGrp != null)
+            {
+                if (m_listPropItemGrp.Count > 0)
+                {
+                    m_listPropItemGrp.Clear();
+                }
+            }
+            // property items group
+            OTS_SAMPLE_PROP_GRID_ITEM_GROUPS a_nId;
+            for (int i = (int)OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.MIN; i <= (int)OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.MAX; i++)
+            {
+
+                List<CPropItem> a_listPropItems = new List<CPropItem>();
+                a_nId = (OTS_SAMPLE_PROP_GRID_ITEM_GROUPS)i;
+                if (m_poMsrParams.m_runmode == RunMode.PlainMode)
+                {
+                    if (a_nId != OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.GENERAL)
+                    {
+                        break;//if it's plain mode then only display the general parameter section.
+                    }
+
+                }
+
+
+
+                CPropItemGrp poPropItemGrp = new CPropItemGrp();
+                // property items group name
+                string strGrpName = string.Empty;
+                strGrpName = ResourceData.GetSourceTitleString((OTS_SAMPLE_PROP_GRID_ITEM_GROUPS)a_nId);
+                if (strGrpName == "")
+                {
+                    return false;
+                }
+                // group name and id
+                poPropItemGrp.SetSTitle(strGrpName);
+                poPropItemGrp.SetGroupId(a_nId);
+                // set group items list
+                OTS_SAMPLE_PROP_GRID_ITEMS nItemId;
+                CPropItem poPropItem;
+                bool bShow = true;
+                //分组编号
+                //int a_nId = ResourceID.GrpGeneral;
+                switch (a_nId)
+                {
+                    case OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.GENERAL:
+                        {
+                            a_nId = ResourceID.GrpGeneral;
+                            // name
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.SAMPLE_NAME;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.STRING, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            // hole
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.SAMPLE_HOLE_NAME;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.STRING, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            // switch
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.SWITCH;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.BOOL, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+
+
+
+
+                            // STD file name
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.STD_FILE_NAME;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.COMBO, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+
+                        }
+                        break;
+
+                    case OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.IMAGESCAN:
+                        {
+                            //a_nId = ResourceID.GrpImageScan;
+                            // start mode
+                            COTSImgScanPrm pScanParam = m_poMsrParams.GetImageScanParam();
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.START_PHOTO_MODE;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.COMBO, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            //// stop mode
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.STOP_MODE;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.STRING, true, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+
+                            // particle
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.STOP_PARAM_PARTICLE;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, true, false);
+                            a_listPropItems.Add(poPropItem);
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.STOP_PARAM_FIELD;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, true, false);
+                            a_listPropItems.Add(poPropItem);
+
+                            // used time
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.STOP_PARAM_TIME;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, true, false);
+                            a_listPropItems.Add(poPropItem);
+
+
+                            // area
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.STOP_PARAM_AREA;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, true, false);
+                            a_listPropItems.Add(poPropItem);
+
+                            // scan speed
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.SCAN_SPEED;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.COMBO, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            // image resolution
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.IMAGE_RESOLUTION;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.COMBO, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                        }
+                        break;
+
+                    case OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.IMAGE_PROCESS:
+                        {
+                            //a_nId = ResourceID.GrpImageProcess;
+                            COTSImageProcParam pProcParam = m_poMsrParams.GetImageProcessParam();
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.BGREMOVE_TYPE;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.COMBO, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            switch (m_poMsrParams.GetImageProcessParam().GetBGRemoveType())
+                            {
+                                case OTS_BGREMOVE_TYPE.AUTO:
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.AUTOBGREMOVE_TYPE;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.COMBO, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+                                    // particle area min
+
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_AREA_MIN;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+
+                                    // particle area max
+
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_AREA_MAX;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+
+                                    break;
+                                case OTS_BGREMOVE_TYPE.MANUAL:
+
+
+                                    // BG gray level min
+
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.BG_GRAY_MIN;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+
+                                    // BG gray level max
+
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.BG_GRAY_MAX;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+                                    //here,no longer consider the gray range of particles,for we can get the same result by regulate the background range.(gsp 2021.8.13)
+                                    //---------------------------------------------
+                                    // particle gray level min
+
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_GRAY_MIN;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+
+                                    // particle gray level max
+
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_GRAY_MAX;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+                                    //----------------------------------------------
+
+                                    // particle area min
+
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_AREA_MIN;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+
+                                    // particle area max
+
+                                    poPropItem = new CPropItem();
+                                    nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_AREA_MAX;
+                                    poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, false, bShow);
+                                    a_listPropItems.Add(poPropItem);
+
+
+
+                                    break;
+
+                            }
+                        }
+                        break;
+
+                    case OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.XRAY:
+                        {
+                            //a_nId = ResourceID.GrpXray;
+                            //COTSXRayParam pXrayParam = m_poMsrParams.GetXRayParam();
+
+
+
+
+                            //using xray
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.USING_XRAY;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.BOOL, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            // scan mode 
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.XRAYSCAN_MODE;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.COMBO, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+                            //quantify analysis min size
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.XRAY_QUANTIFY_MINSIZE;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            // analysis 
+
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.ANALYSIS_RESOLUTION;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            //fast xray time.
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.XRAY_FASTTIME;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            // analysis counts 
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.ANALYSIS_COUNTS;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+
+                            // XrayLimit 
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.XrayLimit;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, false, bShow);
+                            a_listPropItems.Add(poPropItem);
+                        }
+                        break;
+                    case OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.SEM:
+                        {
+                           
+                            CSEMDataMsr m_TempSEMDataMsr = new CSEMDataMsr();
+                            if ((m_poSEMDataMsr.GetScanFieldSize100() == m_TempSEMDataMsr.GetScanFieldSize100())
+                                && (m_poSEMDataMsr.GetTotalFields() == m_TempSEMDataMsr.GetTotalFields())
+                                && (m_poSEMDataMsr.GetWorkingDistance() == m_TempSEMDataMsr.GetWorkingDistance())
+                                && (m_poSEMDataMsr.GetScanFieldSize() == m_TempSEMDataMsr.GetScanFieldSize()))
+                            {
+                                // magnification
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.MAGNIFICATION;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.STRING, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // pixel size
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.IMAGERESOLUTION_SIZE;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.STRING, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // working distance
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.WORKING_DISTANCE;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.STRING, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // total field
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_FIELDS;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.STRING, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // total area
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_TO_MEASURE_AREA;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, true, true);
+                                a_listPropItems.Add(poPropItem);
+                            }
+                            else
+                            {
+                                // magnification
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.MAGNIFICATION;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, false, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // pixel size
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.IMAGERESOLUTION_SIZE;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, false, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // working distance
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.WORKING_DISTANCE;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // total field
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_FIELDS;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // total area
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_TO_MEASURE_AREA;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, true, true);
+                                a_listPropItems.Add(poPropItem);
+                            }
+                        }
+                        break;
+
+                    case OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.MEASURE_STATUS:
+                        {
+                            //a_nId = ResourceID.GrpMeasureState;
+                            // measure status 
+                            poPropItem = new CPropItem();
+                            nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.MEASURE_STATAU;
+                            poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.STRING, true, true);
+                            a_listPropItems.Add(poPropItem);
+
+                            // has measure result?
+                            if (m_Sample. HasMeasureResult())
+                            {
+                                // start time 
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.START_TIME;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.TIME, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // used time 
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.USED_TIME;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.TIME_SPAN, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // finish time 
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.FINISH_TIME;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.TIME, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // completed fields 
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.COMPLETED_FIELDS;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, true, true);
+                                a_listPropItems.Add(poPropItem);
+                            }
+                        }
+                        break;
+
+                    case OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.MEASURE_RESULTS:
+                        {
+                            //a_nId = ResourceID.GrpMeasureResult;
+                            // has measure result?
+                            if (m_Sample. HasMeasureResult())
+                            {
+
+                                // radio 
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.RATIO;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.DOUBLE, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // total measured area 
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_AREA;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // total particles 
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_PARTICLE;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, true, true);
+                                a_listPropItems.Add(poPropItem);
+
+                                // total particle area
+                                poPropItem = new CPropItem();
+                                nItemId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_PARTICLE_AREA;
+                                poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.INT, true, true);
+                                a_listPropItems.Add(poPropItem);
+                            }
+                        }
+                        break;
+
+                    default:
+                        {
+                            // something wrong here, return nullptr
+                            break;
+                        }
+                }
+                poPropItemGrp.SetSampleDataList(a_listPropItems);
+                this.AddASampleDataGrp(poPropItemGrp);
+              
+            }
+            // return property items group
+            return true; ;
+        }
+        public void UpdatePropertyData()
+        {
+            for (int j = 0; j < SampleDataList.Count; j++)
+            {
+                var propertyItem = SampleDataList[j];
+                var provertyValue = GetItemValueStr(propertyItem.SampleId);
+                propertyItem.SetSampleVal(provertyValue);
+            }
+
+        }
+        public bool SetSTDFileName(int iNamePos)
+        {
+            if (!ChangeSTDFromList(iNamePos))
+            {
+                return false;
+            }
+            return true;
+        }
+        public string GetItemValueStr(OTS_SAMPLE_PROP_GRID_ITEMS ItemID)
+        {
+            var m_poMsrParams = m_Sample.GetMsrParams();
+            var m_poSEMDataMsr = m_Sample.GetSEMDataMsr();
+            var m_Status = m_Sample.GetMsrStatus();
+            var m_poMsrResults = m_Sample.GetMsrResults();
+            COTSSample cSample = new COTSSample();
+            //CString strItemID = ItemId;
+            string valStr = "";
+            CPropItem itm = GetPropItemById(ItemID);
+            switch (itm.SampleValType)
+            {
+                case OTS_ITEM_TYPES.BOOL:
+                    {
+                        bool bflag;
+                        if (GetPropBOOLData((int)ItemID, out bflag))
+                        {
+                            valStr = bflag ? "1" : "0";
+                        }
+
+                    }
+                    break;
+                case OTS_ITEM_TYPES.INT:
+                    {
+                        int iVal = 0;
+                        if (GetPropIntData(ItemID, out iVal))
+                        {
+                            valStr = iVal.ToString();
+                        }
+
+                    }
+                    break;
+                case OTS_ITEM_TYPES.DOUBLE:
+                    {
+                        double dVal = 0;
+                        if (GetPropdoubleData(ItemID, out dVal))
+                        {
+                            valStr = dVal.ToString("f2");//点后面几个0就保留几位                                                                          
+                        }
+
+                    }
+                    break;
+                case OTS_ITEM_TYPES.STRING:
+                    {
+                        string StrVal = "";
+                        if (GetPropStringData(ItemID, out StrVal))
+                        {
+                            valStr = StrVal;
+                        }
+
+                    }
+                    break;
+                case OTS_ITEM_TYPES.COMBO:
+                    {
+                        List<string> StrVal = new List<string>();
+                        if (GetPropComboStrings(ItemID,ref StrVal))
+                        {
+                            if (StrVal.Count > 0)
+                            {
+
+                                int index = 0;
+                                GetPropComboData(ItemID, out index);
+                                if (index > (int)StrVal.Count)
+                                {
+                                    valStr = StrVal[0];
+                                    break;
+                                }
+                                valStr = StrVal[index];
+                            }
+                            
+                        }
+
+                    }
+                    break;
+                case OTS_ITEM_TYPES.TIME:
+                    {
+                        System.DateTime dt = new System.DateTime();
+                        if (GetPropTimeData(ItemID, ref dt))
+                        {
+                            valStr = dt.ToString();
+                        }
+
+                    }
+                    break;
+                case OTS_ITEM_TYPES.TIME_SPAN:
+                    {
+                        System.TimeSpan TimeSpanValue = new System.TimeSpan();
+                        if (GetPropTimeSpanData(ItemID, ref TimeSpanValue))
+                        {
+                            int v = (int)TimeSpanValue.TotalSeconds;
+                            valStr = v.ToString();
+                        }
+
+                    }
+                    break;
+
+                default:
+                    break;
+            }
+            return valStr;
+        }
+        public bool GetPropdoubleData(OTS_SAMPLE_PROP_GRID_ITEMS a_nId, out double a_dValue)
+        {
+            var m_poMsrParams = m_Sample.GetMsrParams();
+            var m_poSEMDataMsr = m_Sample.GetSEMDataMsr();
+            var m_Status = m_Sample.GetMsrStatus();
+            var m_poMsrResults = m_Sample.GetMsrResults();
+            switch (a_nId)
+            {
+                case OTS_SAMPLE_PROP_GRID_ITEMS.MAGNIFICATION:
+                    {
+                        a_dValue = m_poSEMDataMsr.GetMagnification();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.IMAGERESOLUTION_SIZE:
+                    {
+                        a_dValue =m_Sample. CalculatePixelSize();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.WORKING_DISTANCE:
+                    {
+                        a_dValue = m_poSEMDataMsr.GetWorkingDistance();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.RATIO:
+                    {
+                        a_dValue = m_poMsrResults.GetRatio();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_AREA_MIN:
+                    {
+                        a_dValue = m_poMsrParams.GetImageProcessParam().GetIncAreaRange().GetStart();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_AREA_MAX:
+                    {
+                        a_dValue = m_poMsrParams.GetImageProcessParam().GetIncAreaRange().GetEnd();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_TO_MEASURE_AREA:
+                    {
+
+                        double dFieldArea = 0; // this area should be the field area
+                        dFieldArea = m_Sample. CalculateAFieldArea();
+                        a_dValue = m_poSEMDataMsr.GetTotalFields() * dFieldArea;
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_AREA:
+                    {
+                        a_dValue = m_poMsrResults.GetMeasuredArea();
+                    }
+                    break;
+
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_PARTICLE_AREA:
+                    {
+                        a_dValue = m_poMsrResults.GetTotalParticleArea();
+                    }
+                    break;
+                case OTS_SAMPLE_PROP_GRID_ITEMS.XRAY_QUANTIFY_MINSIZE:
+                    {
+                        a_dValue = m_poMsrParams.GetXRayParam().GetFeatureModeMinSize();
+                    }
+                    break;
+
+                default:
+                    {
+                        // something wrong, return false
+                        a_dValue = -1;
+                        return false;
+                    }
+
+            }
+
+            // ok, return true
+            return true;
+        }
+
+
+        // string data (7)
+        public bool GetPropStringData(OTS_SAMPLE_PROP_GRID_ITEMS a_nId, out string a_strValue)
+        {
+            var m_poMsrParams = m_Sample.GetMsrParams();
+            var m_poSEMDataMsr = m_Sample.GetSEMDataMsr();
+            var m_Status = m_Sample.GetMsrStatus();
+            var m_poMsrResults = m_Sample.GetMsrResults();
+            switch (a_nId)
+            {
+                case OTS_SAMPLE_PROP_GRID_ITEMS.SAMPLE_NAME:
+                    {
+                        a_strValue = m_Sample.GetName();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.SAMPLE_HOLE_NAME:
+                    {
+                        a_strValue = m_Sample.GetSampleHoleName();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.MAGNIFICATION:
+                    {
+                        a_strValue = NOT_APPLIED;
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.IMAGERESOLUTION_SIZE:
+                    {
+                        a_strValue = NOT_APPLIED;
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.WORKING_DISTANCE:
+                    {
+                        a_strValue = NOT_APPLIED;
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_FIELDS:
+                    {
+                        a_strValue = NOT_APPLIED;
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_TO_MEASURE_AREA:
+                    {
+                        a_strValue = NOT_APPLIED;
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.MEASURE_STATAU:
+                    {
+                        OTS_MSR_SAMPLE_STATUS nStatus = m_Status.GetStatus();
+                        string strStatus = nStatus.ToString();
+                        strStatus = XmlResourceData.GetInstance().GetStringByKey(GrpMeasureResult, IDS_MEASURE_STATUS_FIRST + (int)nStatus);
+                        a_strValue = strStatus;
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.STOP_MODE:
+                    {
+                        a_strValue = m_poMsrParams.GetImageScanParam().GetStopMode();
+                    }
+                    break;
+
+                default:
+                    {
+                        // something wrong, return false
+                        a_strValue = NOT_APPLIED;
+                        return false;
+                    }
+                    //break;
+
+            }
+
+
+            return true;
+        }
+
+        public bool GetPropComboData(OTS_SAMPLE_PROP_GRID_ITEMS a_nId, out int a_nValue)
+        {
+            var m_poMsrParams = m_Sample.GetMsrParams();
+            var m_poSEMDataMsr = m_Sample.GetSEMDataMsr();
+            var m_Status = m_Sample.GetMsrStatus();
+            var m_poMsrResults = m_Sample.GetMsrResults();
+            switch (a_nId)
+            {
+                case OTS_SAMPLE_PROP_GRID_ITEMS.START_PHOTO_MODE:
+                    {
+                        a_nValue = (int)m_poMsrParams.GetImageScanParam().GetFieldStartMode();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.SCAN_SPEED:
+                    {
+                        a_nValue = (int)m_poMsrParams.GetImageScanParam().GetScanImageSpeed();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.IMAGE_RESOLUTION:
+                    {
+                        a_nValue = (int)m_poMsrParams.GetImageScanParam().GetImageResulotion();
+                    }
+                    break;
+
+
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.XRAYSCAN_MODE:
+                    {
+                        a_nValue = (int)m_poMsrParams.GetXRayParam().GetScanMode();
+                    }
+                    break;
+
+             
+                case OTS_SAMPLE_PROP_GRID_ITEMS.BGREMOVE_TYPE:
+                    {
+                        a_nValue = (int)m_poMsrParams.GetImageProcessParam().GetBGRemoveType();
+                    }
+                    break;
+                case OTS_SAMPLE_PROP_GRID_ITEMS.AUTOBGREMOVE_TYPE:
+                    {
+                        a_nValue = (int)m_poMsrParams.GetImageProcessParam().GetAutoBGRemoveType();
+                    }
+                    break;
+                case OTS_SAMPLE_PROP_GRID_ITEMS.STEEL_TECHNOLOGY:
+                    {
+                        a_nValue = (int)m_poMsrParams.GetSteelTechnology();
+                    }
+                    break;
+                case OTS_SAMPLE_PROP_GRID_ITEMS.STD_FILE_NAME:
+                    {
+                        int val = 0;
+                        List<string> combo = new List<string>();
+                        GetSTDFileList(ref val, ref combo);
+                        a_nValue = val;
+                    }
+                    break;
+                default:
+                    {
+                        // something wrong, return false
+                        a_nValue = 0;
+                        return false;
+                    }
+                    //break;
+
+            }
+
+            // ok, return true
+            return true;
+        }
+        public bool GetPropTimeData(OTS_SAMPLE_PROP_GRID_ITEMS a_nId, ref DateTime a_oValue)
+        {
+            var m_poMsrParams = m_Sample.GetMsrParams();
+            var m_poSEMDataMsr = m_Sample.GetSEMDataMsr();
+            var m_Status = m_Sample.GetMsrStatus();
+            var m_poMsrResults = m_Sample.GetMsrResults();
+            switch (a_nId)
+            {
+                case OTS_SAMPLE_PROP_GRID_ITEMS.START_TIME:
+                    {
+                        a_oValue = m_Status.GetStartTime();
+                    }
+                    break;
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.FINISH_TIME:
+                    {
+                        a_oValue = m_Status.GetEndTime();
+                    }
+                    break;
+
+                default:
+                    {
+                        // something wrong, return false
+                        return false;
+                    }
+
+
+            }
+
+
+            return true;
+        }
+
+
+
+        public bool GetPropTimeSpanData(OTS_SAMPLE_PROP_GRID_ITEMS a_nId, ref TimeSpan a_oValue)
+        {
+            var m_poMsrParams = m_Sample.GetMsrParams();
+            var m_poSEMDataMsr = m_Sample.GetSEMDataMsr();
+            var m_Status = m_Sample.GetMsrStatus();
+            var m_poMsrResults = m_Sample.GetMsrResults();
+            switch (a_nId)
+            {
+                case OTS_SAMPLE_PROP_GRID_ITEMS.USED_TIME:
+                    {
+                        a_oValue = m_Status.GetUsedTime();
+                    }
+                    break;
+
+                default:
+                    {
+                        // something wrong, return false
+                        return false;
+                    }
+
+
+            }
+            return true;
+        }
+        private CPropItem GetPropItemById(OTS_SAMPLE_PROP_GRID_ITEMS a_nId)
+        {
+            CPropItem pPropItem = new CPropItem();
+            bool isExist = false;
+            if (m_listPropItemGrp.Count > 0)
+            {
+                foreach (CPropItemGrp poPropItemGrp in m_listPropItemGrp)
+                {
+                    List<CPropItem> listPropItems = poPropItemGrp.GetSampleDataList();
+                    if (listPropItems.Count > 0)
+                    {
+                        foreach (CPropItem cPropItem in listPropItems)
+                        {
+                            if (cPropItem.SampleId == a_nId)
+                            {
+                                pPropItem = cPropItem;
+                                isExist = true;
+                                break;
+                            }
+                        }
+                        if (isExist)
+                        {
+                            break;
+                        }
+                    }
+                }
+            }
+            return pPropItem;
+        }
+        public bool GetPropComboStrings(OTS_SAMPLE_PROP_GRID_ITEMS a_nId,ref List<string> a_listComboStrings)
+        {
+            OTS_SAMPLE_PROP_GRID_ITEM_GROUPS g = ResourceData.GetResourceGrpIdOfPropItem(a_nId);
+
+            a_listComboStrings.Clear();
+
+            switch (a_nId)
+            {
+
+                case OTS_SAMPLE_PROP_GRID_ITEMS.STD_FILE_NAME:
+                    {
+
+                        int val = 0;
+                        List<string> combo = new List<string>();
+                        GetSTDFileList(ref val, ref combo);
+                        a_listComboStrings = combo;
+                    }
+                    break;
+
+                default:
+                    {
+                        var strRes = XmlResourceData.GetInstance().GetStringResourceByKey(g, a_nId);
+
+                        a_listComboStrings = strRes.combolist;
+                    }
+                    break;
+
+            }
+            return true;
+
+          
+        }
+
+
+
+
+        public void  AddASampleDataGrp(CPropItemGrp g)
+        {
+            m_listPropItemGrp.Add(g);
+            SampleDataList .AddRange(g.GetSampleDataList());//保持一个所有条目列表目的为了兼容以前的代码
+        }
+        public List<CPropItemGrp> GetSampleDataGroups()
+        {
+            return m_listPropItemGrp;
+        }
+       
+        public void ClearGrp()
+        {
+            m_listPropItemGrp.Clear();
+            SampleDataList.Clear();
+        }
+
+        public String sSampleSoluName;          //样品的标题名 (Treeview的根节点名)
+        private bool bSwitch;                   //样品参数锁,默认都是false, 当执行测量完成后,设置为true,则客户不允许修改GRID等数据。
+
+        //MeasureApp 给SampleWindow窗口发送添加样品的样品孔名,测量区域信息
+        public SampleMeasurePara SMeasurePara;
+
+       
+
+        public CTreeSampleParam TSampleParam;
+
+        public List<CPropItem> SampleDataList { get => sampleDataList; set => sampleDataList = value; }
+    }
+
+
+}

+ 134 - 0
OTSIncAMeasureApp/ServiceCenter/FEIEDSController.cs

@@ -0,0 +1,134 @@
+using FEIApiControl;
+using OTSCLRINTERFACE;
+using OTSModelSharp.ServiceCenter;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+
+
+namespace OTSMeasureApp.ServiceCenter
+{
+    class FEIEDSController : IEDSController
+    {
+        private  APIClass ApiClass = null;
+      
+        private int AnalyExpCount = 100000;
+        private string strResolution = "";
+        public FEIEDSController(int ResolutionWidth, int ResolutionHeight, int MaxCounts)
+        {
+            ApiClass = new APIClass();
+            SetResolution(ResolutionWidth, ResolutionHeight);
+            SetAnalyExpCount(MaxCounts);
+        }
+        public bool GetXRayByFeatures(List<COTSParticleClr> a_listParticles, double a_nXRayAQTime, bool a_bElementInfo)
+        {
+            for (int i = 0; i < a_listParticles.Count; i++)
+            {
+                Rectangle rectangle = (Rectangle)a_listParticles[i].GetParticleRect();
+                Dictionary<string, double> eleItems = new Dictionary<string, double>();
+                uint[] spectrumItems = new uint[2000];
+                if (!ApiClass.GetXRayByRect(rectangle, strResolution, a_nXRayAQTime, AnalyExpCount, a_bElementInfo, ref eleItems, ref spectrumItems))
+                {
+                    return false;
+                }
+                a_listParticles[i].GetXray().SetXrayData(spectrumItems);
+                if (a_bElementInfo)
+                {
+                    List<CElementChemistryClr> elementChemistryClrs = new List<CElementChemistryClr>();
+                    for (int j = 0; j < eleItems.Count; j++)
+                    {
+                        CElementChemistryClr chemistryClr = new CElementChemistryClr();
+                        chemistryClr.SetName(eleItems.ElementAt(j).Key);
+                        chemistryClr.SetPercentage(eleItems.ElementAt(j).Value);
+                        elementChemistryClrs.Add(chemistryClr);
+                    }
+                    a_listParticles[i].GetXray().SetElementQuantifyData(elementChemistryClrs);
+                }
+            }
+            return true;
+        }
+
+        public bool GetXRayByParts(List<COTSParticleClr> a_listParticles, uint a_nXRayAQTime, bool a_bElementInfo)
+        {
+            for (int i = 0; i < a_listParticles.Count; i++)
+            {
+                Point point = (Point)a_listParticles[i].GetXRayPos();
+                Dictionary<string, double> eleItems = new Dictionary<string, double>();
+                uint[] spectrumItems = new uint[2000];
+                if (!ApiClass.GetXRayByPoint(point.X, point.Y, strResolution, a_nXRayAQTime, AnalyExpCount, a_bElementInfo, ref eleItems, ref spectrumItems))
+                {
+                    return false;
+                }
+                a_listParticles[i].GetXray().SetXrayData(spectrumItems);
+                if (a_bElementInfo)
+                {
+                    List<CElementChemistryClr> elementChemistryClrs = new List<CElementChemistryClr>();
+                    for (int j = 0; j < eleItems.Count; j++)
+                    {
+                        CElementChemistryClr chemistryClr = new CElementChemistryClr();
+                        chemistryClr.SetName(eleItems.ElementAt(j).Key);
+                        chemistryClr.SetPercentage(eleItems.ElementAt(j).Value);
+                        elementChemistryClrs.Add(chemistryClr);
+                    }
+                    a_listParticles[i].GetXray().SetElementQuantifyData(elementChemistryClrs);
+                }
+            }
+            return true;
+        }
+        public bool CollectSpectrum(uint a_nXRayAQTime, ref uint[] a_XrayData)
+        {
+            
+                Dictionary<string, double> eleItems = new Dictionary<string, double>();
+
+                return ApiClass.AcquireSpectrum(false, ref eleItems, ref a_XrayData);
+           
+        }
+
+        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);
+        }
+        private bool SetResolution(int ResolutionWidth, int ResolutionHeight)
+        {
+            
+                strResolution = ResolutionWidth + "x" + ResolutionHeight;
+          
+            return true;
+        }
+
+        private bool SetAnalyExpCount(int MaxCounts)
+        {
+            
+                AnalyExpCount = MaxCounts;
+          
+
+            return true;
+        }
+
+        public EDSTYPE GetEDSType()
+        {
+            return EDSTYPE.FEI;
+        }
+
+     
+
+        public void SetFilterKeyEleNames(List<string> KeyNameList)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 70 - 0
OTSIncAMeasureApp/ServiceCenter/FEIScanController.cs

@@ -0,0 +1,70 @@
+using FEIApiControl;
+using OTSCLRINTERFACE;
+using OTSModelSharp.ServiceCenter;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OTSMeasureApp.ServiceCenter
+{
+    class FEIScanController : IScanController
+    {
+        int imageWidth = 0;
+        int imageHeight = 0;
+        double dwelltime = 0;
+       private APIClass ApiClass = null;
+       public FEIScanController()
+        {
+            ApiClass = new APIClass();
+        }
+        public CBSEImgClr AcquireBSEImage()
+        {
+            Rectangle r = new Rectangle();
+            CBSEImgClr bse = new CBSEImgClr(r);
+            bse.InitImageData(imageWidth, imageHeight);
+            byte[] imgData = new byte[imageWidth * imageHeight];
+            if (!ApiClass.RunAcquireImage(imageWidth, imageHeight, dwelltime, "", ref imgData))
+            {
+                return null;
+            }
+            bse.SetImageData(imgData, 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);
+        }
+
+        public bool SetDwellTime(double val)
+        {
+            dwelltime = val;
+            return true;
+        }
+
+        public bool SetImageSize(int nWidth, int nHeight)
+        {
+            imageWidth = nWidth;
+            imageHeight = nHeight;
+
+            return   ApiClass.SetResolution(imageWidth, imageHeight); ;
+        }
+    }
+}

+ 184 - 0
OTSIncAMeasureApp/ServiceCenter/FEISemController.cs

@@ -0,0 +1,184 @@
+using FEIApiControl;
+using OTSCLRINTERFACE;
+using OTSModelSharp.ServiceCenter;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OTSMeasureApp.ServiceCenter
+{
+    class FEISemController : ISemController
+    {
+          APIClass ApiClass = null;
+       public FEISemController()
+        {
+            ApiClass = new APIClass();
+
+        }
+        public bool Connect()
+        {
+            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);
+        }
+
+        public bool DisConnect()
+        {
+            return ApiClass.DisConnect();
+        }
+
+      
+
+        public bool GetMagnification(ref double a_dMagnification)
+        {
+            return ApiClass.GetMagnification(ref a_dMagnification);
+        }
+
+        public bool GetScanFieldSize(ref double dScanFieldSizeX, ref double dScanFieldSizeY)
+        {
+            return ApiClass.GetSemScanFieldSize(ref dScanFieldSizeX, ref dScanFieldSizeY);
+        }
+
+        public bool GetScanFieldSize100(ref double dScanFieldSizeX, ref double dScanFieldSizeY)
+        {
+            ApiClass.SetMagnification(100);
+            return ApiClass.GetSemScanFieldSize(ref dScanFieldSizeX, ref dScanFieldSizeY);
+        }
+
+        public bool GetSemBeamBlank(ref int a_nBeamBlank)
+        {
+            if (ApiClass.GetIsBlanked())
+            {
+                a_nBeamBlank = 1;
+            }
+            else
+            {
+                a_nBeamBlank = 0;
+            }
+            return true;
+        }
+
+        public bool GetSemBrightness(ref double a_dBrightness)
+        {
+            a_dBrightness = ApiClass.GetDetectorBrightness();
+            return true;
+        }
+
+        public bool GetSemContrast(ref double a_dContrast)
+        {
+            a_dContrast = ApiClass.GetDetectorContrast();
+            return true;
+        }
+
+        public bool GetSemHighTension(ref double a_dKV)
+        {
+            a_dKV = ApiClass.GetHightVoltage() / 1000;
+            return true;
+        }
+
+        public bool GetSemPositionXY(ref double a_dPositionX, ref double a_dPositionY, ref double a_dPositionR)
+        {
+            double a_dPositionZ = 0;
+            double a_dPositionT = 0;
+            return ApiClass.GetSemPositionXYZRT(ref a_dPositionX, ref a_dPositionY, ref a_dPositionZ, ref a_dPositionR, ref a_dPositionT);
+
+        }
+
+        public bool GetWorkingDistance(ref double a_distance)
+        {
+            return ApiClass.GetWorkingDistance(ref a_distance);
+        }
+
+        public bool IsConnected()
+        {
+            return ApiClass.isConnect();
+        }
+
+        public bool MoveSEMToPoint(double a_dPositionX, double a_dPositionY, double rotation)
+        {
+            return ApiClass.SetSemPositionXYR(a_dPositionX, a_dPositionY, rotation);
+        }
+
+        public bool MoveSEMToPoint(double a_dPositionX, double a_dPositionY)
+        {
+            return ApiClass.SetSemPositionXY(a_dPositionX, a_dPositionY);
+        }
+
+        public bool SetMagnification(double a_dMagnification)
+        {
+            return ApiClass.SetMagnification(a_dMagnification);
+        }
+
+        public bool SetScanExternal(bool b)
+        {
+            return ApiClass.SetSemScanExternal(b);
+        }
+
+        public bool SetScanFieldSize100(double dScanFieldSizeX, double dScanFieldSizeY)
+        {
+            throw new NotImplementedException();
+        }
+
+        public bool SetSemBeamBlank(bool val)
+        {
+            if (val)
+            {
+                return ApiClass.SetBeamStateOn();
+            }
+            else
+            {
+                return ApiClass.SetBeamStateOff();
+            }
+        }
+
+        public bool SetSemBeamCurrent(bool val)
+        {
+            if (val)
+            {
+                return ApiClass.SetBeamStateOn();
+            }
+            else
+            {
+                return ApiClass.SetBeamStateOff();
+            }
+        }
+
+        public bool SetSemBrightness(double a_dBrightness)
+        {
+            return ApiClass.SetDetectorBrightness(a_dBrightness);
+        }
+
+        public bool SetSemContrast(double a_dContrast)
+        {
+            return ApiClass.SetDetectorContrast(a_dContrast);
+        }
+
+        public bool SetSemHighTension(double a_dKV)
+        {
+            return ApiClass.SetHightVoltage(a_dKV);
+        }
+
+        public bool SetWorkingDistance(double a_distance)
+        {
+            return ApiClass.SetWorkingDistance(a_distance);
+        }
+
+        public bool StopXrayAcquisition()
+        {
+            return ApiClass.DisConnect();
+        }
+    }
+}

+ 715 - 0
OTSPartA_STDEditor/Form_Main.Designer.cs

@@ -0,0 +1,715 @@
+namespace OTSPartA_STDEditor
+{
+    partial class Form_Main
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            OTS.WinFormsUI.Docking.DockPanelSkin dockPanelSkin2 = new OTS.WinFormsUI.Docking.DockPanelSkin();
+            OTS.WinFormsUI.Docking.AutoHideStripSkin autoHideStripSkin2 = new OTS.WinFormsUI.Docking.AutoHideStripSkin();
+            OTS.WinFormsUI.Docking.DockPanelGradient dockPanelGradient4 = new OTS.WinFormsUI.Docking.DockPanelGradient();
+            OTS.WinFormsUI.Docking.TabGradient tabGradient8 = new OTS.WinFormsUI.Docking.TabGradient();
+            OTS.WinFormsUI.Docking.DockPaneStripSkin dockPaneStripSkin2 = new OTS.WinFormsUI.Docking.DockPaneStripSkin();
+            OTS.WinFormsUI.Docking.DockPaneStripGradient dockPaneStripGradient2 = new OTS.WinFormsUI.Docking.DockPaneStripGradient();
+            OTS.WinFormsUI.Docking.TabGradient tabGradient9 = new OTS.WinFormsUI.Docking.TabGradient();
+            OTS.WinFormsUI.Docking.DockPanelGradient dockPanelGradient5 = new OTS.WinFormsUI.Docking.DockPanelGradient();
+            OTS.WinFormsUI.Docking.TabGradient tabGradient10 = new OTS.WinFormsUI.Docking.TabGradient();
+            OTS.WinFormsUI.Docking.DockPaneStripToolWindowGradient dockPaneStripToolWindowGradient2 = new OTS.WinFormsUI.Docking.DockPaneStripToolWindowGradient();
+            OTS.WinFormsUI.Docking.TabGradient tabGradient11 = new OTS.WinFormsUI.Docking.TabGradient();
+            OTS.WinFormsUI.Docking.TabGradient tabGradient12 = new OTS.WinFormsUI.Docking.TabGradient();
+            OTS.WinFormsUI.Docking.DockPanelGradient dockPanelGradient6 = new OTS.WinFormsUI.Docking.DockPanelGradient();
+            OTS.WinFormsUI.Docking.TabGradient tabGradient13 = new OTS.WinFormsUI.Docking.TabGradient();
+            OTS.WinFormsUI.Docking.TabGradient tabGradient14 = new OTS.WinFormsUI.Docking.TabGradient();
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form_Main));
+            this.ribbonSeparator1 = new System.Windows.Forms.RibbonSeparator();
+            this.ribbonTextBox1 = new System.Windows.Forms.RibbonTextBox();
+            this.ribbonTextBox2 = new System.Windows.Forms.RibbonTextBox();
+            this.ribbonSeparator2 = new System.Windows.Forms.RibbonSeparator();
+            this.ribbonPanel1 = new System.Windows.Forms.RibbonPanel();
+            this.ribbonItemGroup1 = new System.Windows.Forms.RibbonItemGroup();
+            this.ribbonComboBox1 = new System.Windows.Forms.RibbonComboBox();
+            this.ribbonButtonList1 = new System.Windows.Forms.RibbonButtonList();
+            this.ribbon1 = new System.Windows.Forms.Ribbon();
+            this.ribbon_ESDMaxRules = new System.Windows.Forms.RibbonOrbMenuItem();
+            this.ribbon_ZeroRules = new System.Windows.Forms.RibbonOrbMenuItem();
+            this.ribbon_UserConstants = new System.Windows.Forms.RibbonOrbMenuItem();
+            this.ribbon_GroupNameMaintenance = new System.Windows.Forms.RibbonOrbMenuItem();
+            this.ribbon_BulkImport = new System.Windows.Forms.RibbonOrbMenuItem();
+            this.ribbon_ConvertOreDatabaseToOtsDatabase = new System.Windows.Forms.RibbonOrbMenuItem();
+            this.rbMatchescorrespondingelement = new System.Windows.Forms.RibbonOrbMenuItem();
+            this.ribbonSeparator3 = new System.Windows.Forms.RibbonSeparator();
+            this.ribbon_Exit = new System.Windows.Forms.RibbonOrbMenuItem();
+            this.ribbonTab2 = new System.Windows.Forms.RibbonTab();
+            this.ribbonPanel3 = new System.Windows.Forms.RibbonPanel();
+            this.rbOpen = new System.Windows.Forms.RibbonButton();
+            this.rbClose = new System.Windows.Forms.RibbonButton();
+            this.rbNew = new System.Windows.Forms.RibbonButton();
+            this.rbBackup = new System.Windows.Forms.RibbonButton();
+            this.rbSave = new System.Windows.Forms.RibbonButton();
+            this.ribbonPanel2 = new System.Windows.Forms.RibbonPanel();
+            this.ribbonTab1 = new System.Windows.Forms.RibbonTab();
+            this.ribbonTab3 = new System.Windows.Forms.RibbonTab();
+            this.ribbonPanel4 = new System.Windows.Forms.RibbonPanel();
+            this.ribbonTextBox3 = new System.Windows.Forms.RibbonTextBox();
+            this.dockPanel1 = new OTS.WinFormsUI.Docking.DockPanel();
+            this.ribbonOrbRecentItem1 = new System.Windows.Forms.RibbonOrbRecentItem();
+            this.ribbonOrbOptionButton1 = new System.Windows.Forms.RibbonOrbOptionButton();
+            this.ribbonOrbMenuItem1 = new System.Windows.Forms.RibbonOrbMenuItem();
+            this.ribbonDescriptionMenuItem1 = new System.Windows.Forms.RibbonDescriptionMenuItem();
+            this.ribbonColorChooser1 = new System.Windows.Forms.RibbonColorChooser();
+            this.ribbonOrbMenuItem2 = new System.Windows.Forms.RibbonOrbMenuItem();
+            this.ribbonButton1 = new System.Windows.Forms.RibbonButton();
+            this.ribbonButton2 = new System.Windows.Forms.RibbonButton();
+            this.ribbonButton3 = new System.Windows.Forms.RibbonButton();
+            this.SuspendLayout();
+            // 
+            // ribbonSeparator1
+            // 
+            this.ribbonSeparator1.AltKey = null;
+            this.ribbonSeparator1.Image = null;
+            this.ribbonSeparator1.Tag = null;
+            this.ribbonSeparator1.Text = null;
+            this.ribbonSeparator1.ToolTip = null;
+            this.ribbonSeparator1.ToolTipImage = null;
+            this.ribbonSeparator1.ToolTipTitle = null;
+            // 
+            // ribbonTextBox1
+            // 
+            this.ribbonTextBox1.AltKey = null;
+            this.ribbonTextBox1.Image = null;
+            this.ribbonTextBox1.Tag = null;
+            this.ribbonTextBox1.Text = null;
+            this.ribbonTextBox1.TextBoxText = null;
+            this.ribbonTextBox1.ToolTip = null;
+            this.ribbonTextBox1.ToolTipImage = null;
+            this.ribbonTextBox1.ToolTipTitle = null;
+            // 
+            // ribbonTextBox2
+            // 
+            this.ribbonTextBox2.AltKey = null;
+            this.ribbonTextBox2.Image = null;
+            this.ribbonTextBox2.Tag = null;
+            this.ribbonTextBox2.Text = null;
+            this.ribbonTextBox2.TextBoxText = null;
+            this.ribbonTextBox2.ToolTip = null;
+            this.ribbonTextBox2.ToolTipImage = null;
+            this.ribbonTextBox2.ToolTipTitle = null;
+            // 
+            // ribbonSeparator2
+            // 
+            this.ribbonSeparator2.AltKey = null;
+            this.ribbonSeparator2.Image = null;
+            this.ribbonSeparator2.Tag = null;
+            this.ribbonSeparator2.Text = null;
+            this.ribbonSeparator2.ToolTip = null;
+            this.ribbonSeparator2.ToolTipImage = null;
+            this.ribbonSeparator2.ToolTipTitle = null;
+            // 
+            // ribbonPanel1
+            // 
+            this.ribbonPanel1.Tag = null;
+            this.ribbonPanel1.Text = null;
+            // 
+            // ribbonItemGroup1
+            // 
+            this.ribbonItemGroup1.AltKey = null;
+            this.ribbonItemGroup1.Image = null;
+            this.ribbonItemGroup1.Tag = null;
+            this.ribbonItemGroup1.Text = null;
+            this.ribbonItemGroup1.ToolTip = null;
+            this.ribbonItemGroup1.ToolTipImage = null;
+            this.ribbonItemGroup1.ToolTipTitle = null;
+            // 
+            // ribbonComboBox1
+            // 
+            this.ribbonComboBox1.AltKey = null;
+            this.ribbonComboBox1.Image = null;
+            this.ribbonComboBox1.Tag = null;
+            this.ribbonComboBox1.Text = null;
+            this.ribbonComboBox1.TextBoxText = null;
+            this.ribbonComboBox1.ToolTip = null;
+            this.ribbonComboBox1.ToolTipImage = null;
+            this.ribbonComboBox1.ToolTipTitle = null;
+            // 
+            // ribbonButtonList1
+            // 
+            this.ribbonButtonList1.AltKey = null;
+            this.ribbonButtonList1.ButtonsSizeMode = System.Windows.Forms.RibbonElementSizeMode.Large;
+            this.ribbonButtonList1.FlowToBottom = false;
+            this.ribbonButtonList1.Image = null;
+            this.ribbonButtonList1.ItemsSizeInDropwDownMode = new System.Drawing.Size(7, 5);
+            this.ribbonButtonList1.Tag = null;
+            this.ribbonButtonList1.Text = null;
+            this.ribbonButtonList1.ToolTip = null;
+            this.ribbonButtonList1.ToolTipImage = null;
+            this.ribbonButtonList1.ToolTipTitle = null;
+            // 
+            // ribbon1
+            // 
+            this.ribbon1.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
+            this.ribbon1.Location = new System.Drawing.Point(0, 0);
+            this.ribbon1.Minimized = false;
+            this.ribbon1.Name = "ribbon1";
+            // 
+            // 
+            // 
+            this.ribbon1.OrbDropDown.BorderRoundness = 7;
+            this.ribbon1.OrbDropDown.Location = new System.Drawing.Point(0, 0);
+            this.ribbon1.OrbDropDown.MenuItems.Add(this.ribbon_ESDMaxRules);
+            this.ribbon1.OrbDropDown.MenuItems.Add(this.ribbon_ZeroRules);
+            this.ribbon1.OrbDropDown.MenuItems.Add(this.ribbon_UserConstants);
+            this.ribbon1.OrbDropDown.MenuItems.Add(this.ribbon_GroupNameMaintenance);
+            this.ribbon1.OrbDropDown.MenuItems.Add(this.ribbon_BulkImport);
+            this.ribbon1.OrbDropDown.MenuItems.Add(this.ribbon_ConvertOreDatabaseToOtsDatabase);
+            this.ribbon1.OrbDropDown.MenuItems.Add(this.rbMatchescorrespondingelement);
+            this.ribbon1.OrbDropDown.MenuItems.Add(this.ribbonSeparator3);
+            this.ribbon1.OrbDropDown.MenuItems.Add(this.ribbon_Exit);
+            this.ribbon1.OrbDropDown.Name = "";
+            this.ribbon1.OrbDropDown.Size = new System.Drawing.Size(527, 427);
+            this.ribbon1.OrbDropDown.TabIndex = 0;
+            this.ribbon1.OrbImage = global::OTSPartA_STDEditor.Properties.Resources.公司图标;
+            // 
+            // 
+            // 
+            this.ribbon1.QuickAcessToolbar.AltKey = null;
+            this.ribbon1.QuickAcessToolbar.Image = null;
+            this.ribbon1.QuickAcessToolbar.Tag = null;
+            this.ribbon1.QuickAcessToolbar.Text = null;
+            this.ribbon1.QuickAcessToolbar.ToolTip = null;
+            this.ribbon1.QuickAcessToolbar.ToolTipImage = null;
+            this.ribbon1.QuickAcessToolbar.ToolTipTitle = null;
+            this.ribbon1.Size = new System.Drawing.Size(1805, 130);
+            this.ribbon1.TabIndex = 0;
+            this.ribbon1.Tabs.Add(this.ribbonTab2);
+            this.ribbon1.TabSpacing = 6;
+            this.ribbon1.Text = "ribbon1";
+            // 
+            // ribbon_ESDMaxRules
+            // 
+            this.ribbon_ESDMaxRules.AltKey = null;
+            this.ribbon_ESDMaxRules.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
+            this.ribbon_ESDMaxRules.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbon_ESDMaxRules.Enabled = false;
+            this.ribbon_ESDMaxRules.Image = global::OTSPartA_STDEditor.Properties.Resources.Ruler161;
+            this.ribbon_ESDMaxRules.SmallImage = global::OTSPartA_STDEditor.Properties.Resources.Ruler161;
+            this.ribbon_ESDMaxRules.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbon_ESDMaxRules.Tag = "ribbon_ESDMaxRules";
+            this.ribbon_ESDMaxRules.Text = "ESD Max Rules";
+            this.ribbon_ESDMaxRules.ToolTip = null;
+            this.ribbon_ESDMaxRules.ToolTipImage = null;
+            this.ribbon_ESDMaxRules.ToolTipTitle = null;
+            this.ribbon_ESDMaxRules.Click += new System.EventHandler(this.ribbon_ESDMaxRules_Click);
+            // 
+            // ribbon_ZeroRules
+            // 
+            this.ribbon_ZeroRules.AltKey = null;
+            this.ribbon_ZeroRules.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
+            this.ribbon_ZeroRules.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbon_ZeroRules.Enabled = false;
+            this.ribbon_ZeroRules.Image = global::OTSPartA_STDEditor.Properties.Resources.编辑;
+            this.ribbon_ZeroRules.SmallImage = global::OTSPartA_STDEditor.Properties.Resources.编辑;
+            this.ribbon_ZeroRules.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbon_ZeroRules.Tag = "ribbon_ZeroRules";
+            this.ribbon_ZeroRules.Text = "Zero Rules";
+            this.ribbon_ZeroRules.ToolTip = null;
+            this.ribbon_ZeroRules.ToolTipImage = null;
+            this.ribbon_ZeroRules.ToolTipTitle = null;
+            this.ribbon_ZeroRules.Click += new System.EventHandler(this.ribbon_ZeroRules_Click);
+            // 
+            // ribbon_UserConstants
+            // 
+            this.ribbon_UserConstants.AltKey = null;
+            this.ribbon_UserConstants.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
+            this.ribbon_UserConstants.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbon_UserConstants.Enabled = false;
+            this.ribbon_UserConstants.Image = global::OTSPartA_STDEditor.Properties.Resources.worddocument32;
+            this.ribbon_UserConstants.SmallImage = global::OTSPartA_STDEditor.Properties.Resources.worddocument32;
+            this.ribbon_UserConstants.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbon_UserConstants.Tag = "ribbon_UserConstants";
+            this.ribbon_UserConstants.Text = "常量表达式";
+            this.ribbon_UserConstants.ToolTip = null;
+            this.ribbon_UserConstants.ToolTipImage = null;
+            this.ribbon_UserConstants.ToolTipTitle = null;
+            this.ribbon_UserConstants.Click += new System.EventHandler(this.ribbon_UserConstants_Click);
+            // 
+            // ribbon_GroupNameMaintenance
+            // 
+            this.ribbon_GroupNameMaintenance.AltKey = null;
+            this.ribbon_GroupNameMaintenance.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
+            this.ribbon_GroupNameMaintenance.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbon_GroupNameMaintenance.Enabled = false;
+            this.ribbon_GroupNameMaintenance.Image = global::OTSPartA_STDEditor.Properties.Resources.编辑;
+            this.ribbon_GroupNameMaintenance.SmallImage = global::OTSPartA_STDEditor.Properties.Resources.编辑;
+            this.ribbon_GroupNameMaintenance.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbon_GroupNameMaintenance.Tag = "ribbon_GroupNameMaintenance";
+            this.ribbon_GroupNameMaintenance.Text = "组名维护";
+            this.ribbon_GroupNameMaintenance.ToolTip = null;
+            this.ribbon_GroupNameMaintenance.ToolTipImage = null;
+            this.ribbon_GroupNameMaintenance.ToolTipTitle = null;
+            this.ribbon_GroupNameMaintenance.Click += new System.EventHandler(this.ribbon_GroupNameMaintenance_Click);
+            // 
+            // ribbon_BulkImport
+            // 
+            this.ribbon_BulkImport.AltKey = null;
+            this.ribbon_BulkImport.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
+            this.ribbon_BulkImport.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbon_BulkImport.Enabled = false;
+            this.ribbon_BulkImport.Image = global::OTSPartA_STDEditor.Properties.Resources.worddocument32;
+            this.ribbon_BulkImport.SmallImage = global::OTSPartA_STDEditor.Properties.Resources.worddocument32;
+            this.ribbon_BulkImport.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbon_BulkImport.Tag = "ribbon_BulkImport";
+            this.ribbon_BulkImport.Text = "批量导入X-ray";
+            this.ribbon_BulkImport.ToolTip = null;
+            this.ribbon_BulkImport.ToolTipImage = null;
+            this.ribbon_BulkImport.ToolTipTitle = null;
+            this.ribbon_BulkImport.Click += new System.EventHandler(this.ribbon_BulkImport_Click);
+            // 
+            // ribbon_ConvertOreDatabaseToOtsDatabase
+            // 
+            this.ribbon_ConvertOreDatabaseToOtsDatabase.AltKey = null;
+            this.ribbon_ConvertOreDatabaseToOtsDatabase.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
+            this.ribbon_ConvertOreDatabaseToOtsDatabase.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbon_ConvertOreDatabaseToOtsDatabase.Image = global::OTSPartA_STDEditor.Properties.Resources.worddocument32;
+            this.ribbon_ConvertOreDatabaseToOtsDatabase.SmallImage = global::OTSPartA_STDEditor.Properties.Resources.worddocument32;
+            this.ribbon_ConvertOreDatabaseToOtsDatabase.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbon_ConvertOreDatabaseToOtsDatabase.Tag = "ribbon_ConvertOreDatabaseToOtsDatabase";
+            this.ribbon_ConvertOreDatabaseToOtsDatabase.Text = "矿石数据库转换为ots数据库工具";
+            this.ribbon_ConvertOreDatabaseToOtsDatabase.ToolTip = null;
+            this.ribbon_ConvertOreDatabaseToOtsDatabase.ToolTipImage = null;
+            this.ribbon_ConvertOreDatabaseToOtsDatabase.ToolTipTitle = null;
+            this.ribbon_ConvertOreDatabaseToOtsDatabase.Click += new System.EventHandler(this.ribbon_ConvertOreDatabaseToOtsDatabase_Click);
+            // 
+            // rbMatchescorrespondingelement
+            // 
+            this.rbMatchescorrespondingelement.AltKey = null;
+            this.rbMatchescorrespondingelement.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
+            this.rbMatchescorrespondingelement.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.rbMatchescorrespondingelement.Image = global::OTSPartA_STDEditor.Properties.Resources.Ruler161;
+            this.rbMatchescorrespondingelement.SmallImage = global::OTSPartA_STDEditor.Properties.Resources.Ruler161;
+            this.rbMatchescorrespondingelement.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.rbMatchescorrespondingelement.Tag = "rbMatchescorrespondingelement";
+            this.rbMatchescorrespondingelement.Text = "从矿物数据库中搜索元素信息并移植到新库";
+            this.rbMatchescorrespondingelement.ToolTip = null;
+            this.rbMatchescorrespondingelement.ToolTipImage = null;
+            this.rbMatchescorrespondingelement.ToolTipTitle = null;
+            this.rbMatchescorrespondingelement.Click += new System.EventHandler(this.rbMatchescorrespondingelement_Click);
+            // 
+            // ribbonSeparator3
+            // 
+            this.ribbonSeparator3.AltKey = null;
+            this.ribbonSeparator3.Image = null;
+            this.ribbonSeparator3.Tag = null;
+            this.ribbonSeparator3.Text = null;
+            this.ribbonSeparator3.ToolTip = null;
+            this.ribbonSeparator3.ToolTipImage = null;
+            this.ribbonSeparator3.ToolTipTitle = null;
+            // 
+            // ribbon_Exit
+            // 
+            this.ribbon_Exit.AltKey = null;
+            this.ribbon_Exit.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
+            this.ribbon_Exit.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbon_Exit.Image = global::OTSPartA_STDEditor.Properties.Resources.关机;
+            this.ribbon_Exit.SmallImage = global::OTSPartA_STDEditor.Properties.Resources.关机;
+            this.ribbon_Exit.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbon_Exit.Tag = "ribbon_Exit";
+            this.ribbon_Exit.Text = "退出";
+            this.ribbon_Exit.ToolTip = null;
+            this.ribbon_Exit.ToolTipImage = null;
+            this.ribbon_Exit.ToolTipTitle = null;
+            this.ribbon_Exit.Click += new System.EventHandler(this.ribbon_Exit_Click);
+            // 
+            // ribbonTab2
+            // 
+            this.ribbonTab2.Panels.Add(this.ribbonPanel3);
+            this.ribbonTab2.Tag = "ribbonTab2";
+            this.ribbonTab2.Text = "主页";
+            // 
+            // ribbonPanel3
+            // 
+            this.ribbonPanel3.ButtonMoreVisible = false;
+            this.ribbonPanel3.Items.Add(this.rbOpen);
+            this.ribbonPanel3.Items.Add(this.rbClose);
+            this.ribbonPanel3.Items.Add(this.rbNew);
+            this.ribbonPanel3.Items.Add(this.rbBackup);
+            this.ribbonPanel3.Items.Add(this.rbSave);
+            this.ribbonPanel3.Tag = "ribbonPanel3";
+            this.ribbonPanel3.Text = "文件操作";
+            // 
+            // rbOpen
+            // 
+            this.rbOpen.AltKey = null;
+            this.rbOpen.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Down;
+            this.rbOpen.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.rbOpen.Image = global::OTSPartA_STDEditor.Properties.Resources.Recover321;
+            this.rbOpen.SmallImage = global::OTSPartA_STDEditor.Properties.Resources.Recover321;
+            this.rbOpen.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.rbOpen.Tag = "rbOpen";
+            this.rbOpen.Text = "打开数据库";
+            this.rbOpen.ToolTip = null;
+            this.rbOpen.ToolTipImage = null;
+            this.rbOpen.ToolTipTitle = null;
+            this.rbOpen.Click += new System.EventHandler(this.rbOpen_Click);
+            // 
+            // rbClose
+            // 
+            this.rbClose.AltKey = null;
+            this.rbClose.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Down;
+            this.rbClose.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.rbClose.Enabled = false;
+            this.rbClose.Image = global::OTSPartA_STDEditor.Properties.Resources.Recover321;
+            this.rbClose.SmallImage = global::OTSPartA_STDEditor.Properties.Resources.Recover321;
+            this.rbClose.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.rbClose.Tag = "rbClose";
+            this.rbClose.Text = "关闭数据库";
+            this.rbClose.ToolTip = null;
+            this.rbClose.ToolTipImage = null;
+            this.rbClose.ToolTipTitle = null;
+            this.rbClose.Click += new System.EventHandler(this.rbClose_Click);
+            // 
+            // rbNew
+            // 
+            this.rbNew.AltKey = null;
+            this.rbNew.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Down;
+            this.rbNew.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.rbNew.Image = global::OTSPartA_STDEditor.Properties.Resources.编辑;
+            this.rbNew.SmallImage = global::OTSPartA_STDEditor.Properties.Resources.Recover321;
+            this.rbNew.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.rbNew.Tag = "rbNew";
+            this.rbNew.Text = "新建";
+            this.rbNew.ToolTip = null;
+            this.rbNew.ToolTipImage = null;
+            this.rbNew.ToolTipTitle = null;
+            this.rbNew.Click += new System.EventHandler(this.rbNew_Click);
+            // 
+            // rbBackup
+            // 
+            this.rbBackup.AltKey = null;
+            this.rbBackup.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Down;
+            this.rbBackup.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.rbBackup.Enabled = false;
+            this.rbBackup.Image = global::OTSPartA_STDEditor.Properties.Resources.saveas32;
+            this.rbBackup.SmallImage = global::OTSPartA_STDEditor.Properties.Resources.saveas321;
+            this.rbBackup.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.rbBackup.Tag = "rbBackup";
+            this.rbBackup.Text = "另存为";
+            this.rbBackup.ToolTip = null;
+            this.rbBackup.ToolTipImage = null;
+            this.rbBackup.ToolTipTitle = null;
+            this.rbBackup.Click += new System.EventHandler(this.rbBackup_Click);
+            // 
+            // rbSave
+            // 
+            this.rbSave.AltKey = null;
+            this.rbSave.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Down;
+            this.rbSave.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.rbSave.Enabled = false;
+            this.rbSave.Image = global::OTSPartA_STDEditor.Properties.Resources.另存为;
+            this.rbSave.SmallImage = global::OTSPartA_STDEditor.Properties.Resources.另存为;
+            this.rbSave.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.rbSave.Tag = "rbSave";
+            this.rbSave.Text = "保存";
+            this.rbSave.ToolTip = null;
+            this.rbSave.ToolTipImage = null;
+            this.rbSave.ToolTipTitle = null;
+            this.rbSave.Click += new System.EventHandler(this.rbSave_Click);
+            // 
+            // ribbonPanel2
+            // 
+            this.ribbonPanel2.Tag = null;
+            this.ribbonPanel2.Text = null;
+            // 
+            // ribbonTab1
+            // 
+            this.ribbonTab1.Tag = null;
+            this.ribbonTab1.Text = null;
+            // 
+            // ribbonTab3
+            // 
+            this.ribbonTab3.Tag = null;
+            this.ribbonTab3.Text = null;
+            // 
+            // ribbonPanel4
+            // 
+            this.ribbonPanel4.Tag = null;
+            this.ribbonPanel4.Text = null;
+            // 
+            // ribbonTextBox3
+            // 
+            this.ribbonTextBox3.AltKey = null;
+            this.ribbonTextBox3.Image = null;
+            this.ribbonTextBox3.Tag = null;
+            this.ribbonTextBox3.Text = null;
+            this.ribbonTextBox3.TextBoxText = null;
+            this.ribbonTextBox3.ToolTip = null;
+            this.ribbonTextBox3.ToolTipImage = null;
+            this.ribbonTextBox3.ToolTipTitle = null;
+            // 
+            // dockPanel1
+            // 
+            this.dockPanel1.ActiveAutoHideContent = null;
+            this.dockPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.dockPanel1.DockBackColor = System.Drawing.SystemColors.Control;
+            this.dockPanel1.Location = new System.Drawing.Point(0, 130);
+            this.dockPanel1.Name = "dockPanel1";
+            this.dockPanel1.Size = new System.Drawing.Size(1805, 660);
+            dockPanelGradient4.EndColor = System.Drawing.SystemColors.ControlLight;
+            dockPanelGradient4.StartColor = System.Drawing.SystemColors.ControlLight;
+            autoHideStripSkin2.DockStripGradient = dockPanelGradient4;
+            tabGradient8.EndColor = System.Drawing.SystemColors.Control;
+            tabGradient8.StartColor = System.Drawing.SystemColors.Control;
+            tabGradient8.TextColor = System.Drawing.SystemColors.ControlDarkDark;
+            autoHideStripSkin2.TabGradient = tabGradient8;
+            dockPanelSkin2.AutoHideStripSkin = autoHideStripSkin2;
+            tabGradient9.EndColor = System.Drawing.SystemColors.ControlLightLight;
+            tabGradient9.StartColor = System.Drawing.SystemColors.ControlLightLight;
+            tabGradient9.TextColor = System.Drawing.SystemColors.ControlText;
+            dockPaneStripGradient2.ActiveTabGradient = tabGradient9;
+            dockPanelGradient5.EndColor = System.Drawing.SystemColors.Control;
+            dockPanelGradient5.StartColor = System.Drawing.SystemColors.Control;
+            dockPaneStripGradient2.DockStripGradient = dockPanelGradient5;
+            tabGradient10.EndColor = System.Drawing.SystemColors.ControlLight;
+            tabGradient10.StartColor = System.Drawing.SystemColors.ControlLight;
+            tabGradient10.TextColor = System.Drawing.SystemColors.ControlText;
+            dockPaneStripGradient2.InactiveTabGradient = tabGradient10;
+            dockPaneStripSkin2.DocumentGradient = dockPaneStripGradient2;
+            tabGradient11.EndColor = System.Drawing.SystemColors.ActiveCaption;
+            tabGradient11.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
+            tabGradient11.StartColor = System.Drawing.SystemColors.GradientActiveCaption;
+            tabGradient11.TextColor = System.Drawing.SystemColors.ActiveCaptionText;
+            dockPaneStripToolWindowGradient2.ActiveCaptionGradient = tabGradient11;
+            tabGradient12.EndColor = System.Drawing.SystemColors.Control;
+            tabGradient12.StartColor = System.Drawing.SystemColors.Control;
+            tabGradient12.TextColor = System.Drawing.SystemColors.ControlText;
+            dockPaneStripToolWindowGradient2.ActiveTabGradient = tabGradient12;
+            dockPanelGradient6.EndColor = System.Drawing.SystemColors.ControlLight;
+            dockPanelGradient6.StartColor = System.Drawing.SystemColors.ControlLight;
+            dockPaneStripToolWindowGradient2.DockStripGradient = dockPanelGradient6;
+            tabGradient13.EndColor = System.Drawing.SystemColors.GradientInactiveCaption;
+            tabGradient13.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
+            tabGradient13.StartColor = System.Drawing.SystemColors.GradientInactiveCaption;
+            tabGradient13.TextColor = System.Drawing.SystemColors.ControlText;
+            dockPaneStripToolWindowGradient2.InactiveCaptionGradient = tabGradient13;
+            tabGradient14.EndColor = System.Drawing.Color.Transparent;
+            tabGradient14.StartColor = System.Drawing.Color.Transparent;
+            tabGradient14.TextColor = System.Drawing.SystemColors.ControlDarkDark;
+            dockPaneStripToolWindowGradient2.InactiveTabGradient = tabGradient14;
+            dockPaneStripSkin2.ToolWindowGradient = dockPaneStripToolWindowGradient2;
+            dockPanelSkin2.DockPaneStripSkin = dockPaneStripSkin2;
+            this.dockPanel1.Skin = dockPanelSkin2;
+            this.dockPanel1.TabIndex = 31;
+            // 
+            // ribbonOrbRecentItem1
+            // 
+            this.ribbonOrbRecentItem1.AltKey = null;
+            this.ribbonOrbRecentItem1.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Down;
+            this.ribbonOrbRecentItem1.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbonOrbRecentItem1.Image = ((System.Drawing.Image)(resources.GetObject("ribbonOrbRecentItem1.Image")));
+            this.ribbonOrbRecentItem1.SmallImage = ((System.Drawing.Image)(resources.GetObject("ribbonOrbRecentItem1.SmallImage")));
+            this.ribbonOrbRecentItem1.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbonOrbRecentItem1.Tag = null;
+            this.ribbonOrbRecentItem1.Text = null;
+            this.ribbonOrbRecentItem1.ToolTip = null;
+            this.ribbonOrbRecentItem1.ToolTipImage = null;
+            this.ribbonOrbRecentItem1.ToolTipTitle = null;
+            // 
+            // ribbonOrbOptionButton1
+            // 
+            this.ribbonOrbOptionButton1.AltKey = null;
+            this.ribbonOrbOptionButton1.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Down;
+            this.ribbonOrbOptionButton1.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbonOrbOptionButton1.Image = ((System.Drawing.Image)(resources.GetObject("ribbonOrbOptionButton1.Image")));
+            this.ribbonOrbOptionButton1.SmallImage = ((System.Drawing.Image)(resources.GetObject("ribbonOrbOptionButton1.SmallImage")));
+            this.ribbonOrbOptionButton1.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbonOrbOptionButton1.Tag = null;
+            this.ribbonOrbOptionButton1.Text = null;
+            this.ribbonOrbOptionButton1.ToolTip = null;
+            this.ribbonOrbOptionButton1.ToolTipImage = null;
+            this.ribbonOrbOptionButton1.ToolTipTitle = null;
+            // 
+            // ribbonOrbMenuItem1
+            // 
+            this.ribbonOrbMenuItem1.AltKey = null;
+            this.ribbonOrbMenuItem1.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
+            this.ribbonOrbMenuItem1.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbonOrbMenuItem1.Image = ((System.Drawing.Image)(resources.GetObject("ribbonOrbMenuItem1.Image")));
+            this.ribbonOrbMenuItem1.SmallImage = ((System.Drawing.Image)(resources.GetObject("ribbonOrbMenuItem1.SmallImage")));
+            this.ribbonOrbMenuItem1.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbonOrbMenuItem1.Tag = null;
+            this.ribbonOrbMenuItem1.Text = null;
+            this.ribbonOrbMenuItem1.ToolTip = null;
+            this.ribbonOrbMenuItem1.ToolTipImage = null;
+            this.ribbonOrbMenuItem1.ToolTipTitle = null;
+            // 
+            // ribbonDescriptionMenuItem1
+            // 
+            this.ribbonDescriptionMenuItem1.AltKey = null;
+            this.ribbonDescriptionMenuItem1.Description = null;
+            this.ribbonDescriptionMenuItem1.DescriptionBounds = new System.Drawing.Rectangle(0, 0, 0, 0);
+            this.ribbonDescriptionMenuItem1.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
+            this.ribbonDescriptionMenuItem1.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbonDescriptionMenuItem1.Image = ((System.Drawing.Image)(resources.GetObject("ribbonDescriptionMenuItem1.Image")));
+            this.ribbonDescriptionMenuItem1.SmallImage = ((System.Drawing.Image)(resources.GetObject("ribbonDescriptionMenuItem1.SmallImage")));
+            this.ribbonDescriptionMenuItem1.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbonDescriptionMenuItem1.Tag = null;
+            this.ribbonDescriptionMenuItem1.Text = null;
+            this.ribbonDescriptionMenuItem1.ToolTip = null;
+            this.ribbonDescriptionMenuItem1.ToolTipImage = null;
+            this.ribbonDescriptionMenuItem1.ToolTipTitle = null;
+            // 
+            // ribbonColorChooser1
+            // 
+            this.ribbonColorChooser1.AltKey = null;
+            this.ribbonColorChooser1.Color = System.Drawing.Color.Transparent;
+            this.ribbonColorChooser1.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Down;
+            this.ribbonColorChooser1.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbonColorChooser1.Image = ((System.Drawing.Image)(resources.GetObject("ribbonColorChooser1.Image")));
+            this.ribbonColorChooser1.SmallImage = ((System.Drawing.Image)(resources.GetObject("ribbonColorChooser1.SmallImage")));
+            this.ribbonColorChooser1.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbonColorChooser1.Tag = null;
+            this.ribbonColorChooser1.Text = null;
+            this.ribbonColorChooser1.ToolTip = null;
+            this.ribbonColorChooser1.ToolTipImage = null;
+            this.ribbonColorChooser1.ToolTipTitle = null;
+            // 
+            // ribbonOrbMenuItem2
+            // 
+            this.ribbonOrbMenuItem2.AltKey = null;
+            this.ribbonOrbMenuItem2.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
+            this.ribbonOrbMenuItem2.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbonOrbMenuItem2.Image = ((System.Drawing.Image)(resources.GetObject("ribbonOrbMenuItem2.Image")));
+            this.ribbonOrbMenuItem2.SmallImage = ((System.Drawing.Image)(resources.GetObject("ribbonOrbMenuItem2.SmallImage")));
+            this.ribbonOrbMenuItem2.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbonOrbMenuItem2.Tag = null;
+            this.ribbonOrbMenuItem2.Text = "ribbonOrbMenuItem2";
+            this.ribbonOrbMenuItem2.ToolTip = null;
+            this.ribbonOrbMenuItem2.ToolTipImage = null;
+            this.ribbonOrbMenuItem2.ToolTipTitle = null;
+            // 
+            // ribbonButton1
+            // 
+            this.ribbonButton1.AltKey = null;
+            this.ribbonButton1.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Down;
+            this.ribbonButton1.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbonButton1.Image = ((System.Drawing.Image)(resources.GetObject("ribbonButton1.Image")));
+            this.ribbonButton1.SmallImage = ((System.Drawing.Image)(resources.GetObject("ribbonButton1.SmallImage")));
+            this.ribbonButton1.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbonButton1.Tag = null;
+            this.ribbonButton1.Text = null;
+            this.ribbonButton1.ToolTip = null;
+            this.ribbonButton1.ToolTipImage = null;
+            this.ribbonButton1.ToolTipTitle = null;
+            // 
+            // ribbonButton2
+            // 
+            this.ribbonButton2.AltKey = null;
+            this.ribbonButton2.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Down;
+            this.ribbonButton2.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbonButton2.Image = ((System.Drawing.Image)(resources.GetObject("ribbonButton2.Image")));
+            this.ribbonButton2.SmallImage = ((System.Drawing.Image)(resources.GetObject("ribbonButton2.SmallImage")));
+            this.ribbonButton2.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbonButton2.Tag = null;
+            this.ribbonButton2.Text = null;
+            this.ribbonButton2.ToolTip = null;
+            this.ribbonButton2.ToolTipImage = null;
+            this.ribbonButton2.ToolTipTitle = null;
+            // 
+            // ribbonButton3
+            // 
+            this.ribbonButton3.AltKey = null;
+            this.ribbonButton3.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Down;
+            this.ribbonButton3.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbonButton3.Image = ((System.Drawing.Image)(resources.GetObject("ribbonButton3.Image")));
+            this.ribbonButton3.SmallImage = ((System.Drawing.Image)(resources.GetObject("ribbonButton3.SmallImage")));
+            this.ribbonButton3.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbonButton3.Tag = null;
+            this.ribbonButton3.Text = null;
+            this.ribbonButton3.ToolTip = null;
+            this.ribbonButton3.ToolTipImage = null;
+            this.ribbonButton3.ToolTipTitle = null;
+            // 
+            // Form_ConstantsEditor2
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(1805, 790);
+            this.Controls.Add(this.dockPanel1);
+            this.Controls.Add(this.ribbon1);
+            this.IsMdiContainer = true;
+            this.Name = "Form_ConstantsEditor2";
+            this.ShowIcon = false;
+            this.Text = "表达式编辑器";
+            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_ConstantsEditor2_FormClosing);
+            this.Load += new System.EventHandler(this.Form_ConstantsEditor2_Load);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.RibbonSeparator ribbonSeparator1;
+        private System.Windows.Forms.RibbonTextBox ribbonTextBox1;
+        private System.Windows.Forms.RibbonTextBox ribbonTextBox2;
+        private System.Windows.Forms.RibbonSeparator ribbonSeparator2;
+        private System.Windows.Forms.RibbonPanel ribbonPanel1;
+        private System.Windows.Forms.RibbonOrbRecentItem ribbonOrbRecentItem1;
+        private System.Windows.Forms.RibbonOrbOptionButton ribbonOrbOptionButton1;
+        private System.Windows.Forms.RibbonOrbMenuItem ribbonOrbMenuItem1;
+        private System.Windows.Forms.RibbonItemGroup ribbonItemGroup1;
+        private System.Windows.Forms.RibbonDescriptionMenuItem ribbonDescriptionMenuItem1;
+        private System.Windows.Forms.RibbonComboBox ribbonComboBox1;
+        private System.Windows.Forms.RibbonColorChooser ribbonColorChooser1;
+        private System.Windows.Forms.RibbonButtonList ribbonButtonList1;
+        private System.Windows.Forms.Ribbon ribbon1;
+        private System.Windows.Forms.RibbonPanel ribbonPanel2;
+        private System.Windows.Forms.RibbonTab ribbonTab1;
+        private System.Windows.Forms.RibbonTab ribbonTab2;
+        private System.Windows.Forms.RibbonOrbMenuItem ribbonOrbMenuItem2;
+        private System.Windows.Forms.RibbonPanel ribbonPanel3;
+        private System.Windows.Forms.RibbonTab ribbonTab3;
+        private System.Windows.Forms.RibbonButton ribbonButton1;
+        private System.Windows.Forms.RibbonButton ribbonButton2;
+        private System.Windows.Forms.RibbonButton ribbonButton3;
+        private System.Windows.Forms.RibbonPanel ribbonPanel4;
+        private System.Windows.Forms.RibbonOrbMenuItem ribbon_ESDMaxRules;
+        private System.Windows.Forms.RibbonOrbMenuItem ribbon_ZeroRules;
+        public System.Windows.Forms.RibbonButton rbOpen;
+        public System.Windows.Forms.RibbonButton rbClose;
+        public System.Windows.Forms.RibbonButton rbBackup;
+        public System.Windows.Forms.RibbonButton rbNew;
+        public System.Windows.Forms.RibbonButton rbSave;
+        private System.Windows.Forms.RibbonTextBox ribbonTextBox3;
+        public OTS.WinFormsUI.Docking.DockPanel dockPanel1;
+        private System.Windows.Forms.RibbonOrbMenuItem ribbon_UserConstants;
+        private System.Windows.Forms.RibbonOrbMenuItem ribbon_GroupNameMaintenance;
+        private System.Windows.Forms.RibbonOrbMenuItem ribbon_BulkImport;
+        private System.Windows.Forms.RibbonOrbMenuItem ribbon_ConvertOreDatabaseToOtsDatabase;
+        private System.Windows.Forms.RibbonSeparator ribbonSeparator3;
+        private System.Windows.Forms.RibbonOrbMenuItem ribbon_Exit;
+        private System.Windows.Forms.RibbonOrbMenuItem rbMatchescorrespondingelement;
+    }
+}

+ 1733 - 0
OTSPartA_STDEditor/Form_Main.cs

@@ -0,0 +1,1733 @@
+using SourceGrid;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using System.Xml;
+using System.Xml.Linq;
+
+namespace OTSPartA_STDEditor
+{
+    public partial class Form_Main : Form
+    {
+        OTSDockWindow m_DockWindow = null;
+        public STDRuleslist m_STDRuleslist = null;
+        public Attributes m_Attributes = null;
+        public SubMidWindow m_SubMidWindow = null;
+        public Dictionary<int, STDdata> STDDictionary = new Dictionary<int, STDdata>();
+        private Dictionary<int, STDdata> STDDictionaryInitial=new Dictionary<int, STDdata>();
+        public Dictionary<int,string> GroupIdDictionaryFromId = new Dictionary<int,string>();
+        public Dictionary<string, int> GroupIdDictionaryFromName = new Dictionary<string, int>();
+        string STDDBAddress_backupDirectory = Application.StartupPath + "\\Config\\SysData\\LibBackup\\";
+        public string STDDBAddress = "";
+        /// <summary>
+        /// 0:正在打开的标准库路径;1:所增加标准的颗粒所在结果库位置;2:所增加标准的颗粒FieldId;3:所增加标准的颗粒ParticleId;4:所增加标准的颗粒XRayId
+        /// </summary>
+        List<string> ImportArgs = new List<string>();
+
+        //国际化
+        public Language lan;
+        Hashtable table;
+
+        //是否做出过更改
+        public bool IsModified { set; get; }
+
+        public Form_Main()
+        {
+            InitializeComponent();
+            m_STDRuleslist = new STDRuleslist(this);
+            m_Attributes = new Attributes(this);
+            m_SubMidWindow = new SubMidWindow(this);
+            m_DockWindow = new OTSDockWindow(this);
+        }
+
+        public Form_Main(string[] ImportStandardLibraryArgs)
+        {
+            InitializeComponent();
+            m_STDRuleslist = new STDRuleslist(this);
+            m_Attributes = new Attributes(this);
+            m_SubMidWindow = new SubMidWindow(this);
+            m_DockWindow = new OTSDockWindow(this);
+            foreach (var it in ImportStandardLibraryArgs)
+            {
+                ImportArgs.Add(it);
+            }
+        }
+
+        private void Form_ConstantsEditor2_Load(object sender, EventArgs e)
+        {
+            lan = new Language(this);
+            table = lan.GetNameTable("Form_ConstantsEditor2");
+            if (STDDBAddress != "")
+            {
+                InitForms(STDDBAddress);
+                this.Text = this.Text.Split(' ')[0] + "   " + STDDBAddress;
+                IsModified = false;
+
+                if (ImportArgs.Count > 1)
+                {
+                    ImportStandardLibraryTypeSelection m_importStandardLibraryTypeSelection = new ImportStandardLibraryTypeSelection();
+                    var result = m_importStandardLibraryTypeSelection.ShowDialog();
+                    if (m_importStandardLibraryTypeSelection.SelectEvent == "xray")
+                    {
+                        System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + ImportArgs[1] + "'");
+                        m_dbConnection.Open();
+
+                        string sqlp = @"select xraydata from xraydata where fieldid=" + ImportArgs[2] + " and xrayindex=" + ImportArgs[4];
+                        System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter(sqlp, m_dbConnection);
+                        DataSet ds = new DataSet();
+                        m_dataAdapter.Fill(ds);
+                        DataTable dt = ds.Tables[0];
+                        if (dt.Rows.Count > 0)
+                        {
+                            int STDId = AddSTDDictionaryItem();
+                            if (dt != null)
+                            {
+                                if (dt.Rows.Count > 0)
+                                {
+                                    STDEditor.STDXray tDXray = new STDEditor.STDXray();
+                                    tDXray.StdID = STDId.ToString();
+                                    tDXray.XrayData = (byte[])dt.Rows[0]["XrayData"];
+                                    tDXray.InfoState = (int)STDEditor.STDXrayInfoState.Add;
+                                    m_SubMidWindow.m_STDEditor.m_STDXrayList.Add(tDXray);
+                                    m_STDRuleslist.AddNewRow(STDId, "NewClassify", Color.Gray);
+                                    m_SubMidWindow.m_STDEditor.ShowTabXray();
+                                }
+                            }
+                        }
+                        m_dbConnection.Close();
+                    }
+                    else if (m_importStandardLibraryTypeSelection.SelectEvent == "expression")
+                    {
+                        int STDId = AddSTDDictionaryItem();
+                        m_STDRuleslist.AddNewRow(STDId, "NewClassify", Color.Gray);
+                    }
+                }
+            }
+        }
+
+        void LoadConstants(string STDDBAddress)
+        {
+            try
+            {
+                System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + STDDBAddress + "'");
+                m_dbConnection.Open();
+                System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from Constants", m_dbConnection);
+                DataSet ds = new DataSet();
+                m_dataAdapter.Fill(ds);
+                DataTable dt = ds.Tables[0];
+                if (dt.Rows.Count > 0)
+                {
+                    string ConstantsStr = dt.Rows[0][0].ToString();
+                    ConstantsStr = ConstantsStr.Replace(" ", "");
+                    string[] ConstantsStr2 = ConstantsStr.Split(',');
+                    m_SubMidWindow.m_STDEditor.comboBox_Constants.Items.Clear();
+                    m_SubMidWindow.m_STDEditor.comboBox_Constants.Items.AddRange(ConstantsStr2);
+                }
+                m_dbConnection.Close();
+            }
+            catch (Exception ee)
+            {
+                MessageBox.Show(ee.ToString());
+            }
+        }
+
+       bool LoadClassifyToDictionary(string DBAddress, ref Dictionary<int, STDdata> STDDictionary)
+        {
+            try
+            {
+                //STDDictionaryInitial.Clear();
+
+                System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + DBAddress + "'");
+                m_dbConnection.Open();
+                System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from ClassifySTD order by ListNum", m_dbConnection);
+                DataSet ds = new DataSet();
+                m_dataAdapter.Fill(ds);
+                DataTable dt = ds.Tables[0];
+
+                if (dt != null)
+                {
+                    if (dt.Rows.Count > 0)
+                    {
+                        foreach (DataRow item in dt.Rows)
+                        {
+                            STDdata new_STDdata = new STDdata();
+
+                            new_STDdata.Hardness = item["Hardness"].ToString();
+                            new_STDdata.Density = item["Density"].ToString();
+                            new_STDdata.Electrical_conductivity = item["Electrical_conductivity"].ToString();
+                            new_STDdata.BSE = item["BSE"].ToString();
+                            new_STDdata.Formula = item["Formula"].ToString();
+                            new_STDdata.Element = item["Element"].ToString();
+                            new_STDdata.StrName = item["StrName"].ToString();
+                            new_STDdata.Expression = item["Expression"].ToString();
+                            new_STDdata.Color = item["Color"].ToString();
+                            new_STDdata.KeyElementList = item["KeyElementList"].ToString();
+                            new_STDdata.SubElementList = item["SubElementList"].ToString();
+                            new_STDdata.GroupId = item["GroupId"].ToString();
+                            new_STDdata.ListNum= item["ListNum"].ToString();
+                            new_STDdata.GroupId = item["GroupId"].ToString();
+
+                            STDDictionary.Add(int.Parse(item["STDId"].ToString()), new_STDdata);
+                        }
+                    }
+                }
+                return true;
+            }
+            catch /*(Exception ee)*/
+            {
+                MessageBox.Show("The selected standard library is formatted incorrectly, please open the correct standard library!", "Tip");
+                return false;
+            }
+        }
+
+        public void ChangeSTDEditorAndGrid_Attributes(int STDId)
+        {
+            m_SubMidWindow.ChangeText_textbox_STDEditor(STDId);
+            m_SubMidWindow.SelSTDXray(STDId, STDDictionary[STDId]);
+            m_Attributes.SetDatatoGrid_Attributes(STDId);
+        }
+
+        private void rbBackup_Click(object sender, EventArgs e)
+        {
+            if (m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row >= 0)
+            {
+                //if (m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0].Value.ToString().Replace(" ", "").Trim() != "")
+                //{
+                if (CheckAttributes())
+                {
+                    if (Checktextbox_STDEditor())
+                    {
+                        SaveDataOfSelRule(m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Column);
+
+                        try
+                        {
+                            SaveFileDialog saveFile = new SaveFileDialog();
+                            saveFile.Title = "Please select the path which to save the file";
+                            saveFile.Filter = "Database File(*.db)|*.db";
+                            saveFile.InitialDirectory = Application.StartupPath + "\\Config\\SysData\\";
+                            saveFile.OverwritePrompt = true;  //是否覆盖当前文件
+                                                              //saveFile.RestoreDirectory = true;  //还原上次目录
+                            if (saveFile.ShowDialog() == DialogResult.OK)
+                            {
+                                System.IO.File.Copy(STDDBAddress, saveFile.FileName, true);
+                                bool result = SaveDictionaryToClassify(saveFile.FileName);
+                                STDDBAddress = saveFile.FileName;
+                                this.Text = this.Text.Split(' ')[0] + "   " + saveFile.FileName;
+                                //if (result)
+                                //{
+                                //    MessageBox.Show("Export file successful!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                                //}
+                            }
+                            else
+                            {
+                                return;
+                            }
+                        }
+                        catch (Exception ex)
+                        {
+                            MessageBox.Show(ex.Message);
+                        }
+                    }
+                    //}
+                }
+                else
+                {
+                    MessageBox.Show("The name of rulecannot be empty!", "Tip");
+                }
+            }
+            else
+            {
+                try
+                {
+                    SaveFileDialog saveFile = new SaveFileDialog();
+                    saveFile.Title = "Please select the path which to save the file";
+                    saveFile.Filter = "Database File(*.db)|*.db";
+                    saveFile.OverwritePrompt = true;  //是否覆盖当前文件
+                    saveFile.RestoreDirectory = true;  //还原上次目录
+                    if (saveFile.ShowDialog() == DialogResult.OK)
+                    {
+                        System.IO.File.Copy(STDDBAddress, saveFile.FileName, true);
+                        bool result = SaveDictionaryToClassify(saveFile.FileName);
+                        if (result)
+                        {
+                            MessageBox.Show("Export file successful!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                        }
+                    }
+                    else
+                    {
+                        return;
+                    }
+                }
+                catch (Exception ex)
+                {
+                    MessageBox.Show(ex.Message);
+                }
+            }
+        }
+
+        public bool ClearDb(string DBAddress, string DBTableName)
+        {
+            try
+            {
+                System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + DBAddress + "'");
+                m_dbConnection.Open();
+
+                System.Data.SQLite.SQLiteCommand cmm = m_dbConnection.CreateCommand();
+                cmm.CommandText = "delete from " + DBTableName;
+                cmm.ExecuteNonQuery();
+                m_dbConnection.Close();
+                return true;
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.ToString());
+                return false;
+            }
+        }
+
+        private void rbRecover_Click(object sender, EventArgs e)
+        {
+
+        }
+
+        object Clone(Dictionary<int, STDdata> STDDictionary)
+        {
+            Dictionary<int, STDdata> STDDictionaryInitial = new Dictionary<int, STDdata>();
+            foreach (var key in STDDictionary.Keys)
+            {
+                STDdata tDdata = new STDdata();
+                tDdata = tDdata.Clone(STDDictionary[key]) as STDdata;
+                STDDictionaryInitial.Add(key, tDdata);
+            }
+            return STDDictionaryInitial;
+        }
+
+        private void rbSave_Click(object sender, EventArgs e)
+        {
+            if (m_STDRuleslist.Grid_Minerals.RowsCount > 1)
+            {
+                if (m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row > 0)
+                {
+                    if (m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0].Value.ToString().Replace(" ", "").Trim() != "")
+                    {
+                        if (CheckAttributes())
+                        {
+                            if (Checktextbox_STDEditor())
+                            {
+                                FormForWaiting forWaiting = new FormForWaiting();
+                                forWaiting.Show();
+                                SaveDataOfSelRule(m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0);
+                                // SaveXmlTreeDataToXml(Address);
+                                bool result = SaveDictionaryToClassify(STDDBAddress);
+                                if (result)
+                                {
+                                    m_SubMidWindow.m_STDEditor.SaveSTDXray();
+                                    STDDictionaryInitial.Clear();
+                                    STDDictionaryInitial = Clone(STDDictionary) as Dictionary<int, STDdata>;
+                                    forWaiting.Close();
+                                    IsModified = false;
+                                    //MessageBox.Show("Save successful!", "Tip");
+                                }
+                                else
+                                {
+                                    forWaiting.Close();
+                                    MessageBox.Show("Save failed!", "Tip");
+                                }
+                            }
+                        }
+                    }
+                }
+                else
+                {
+                    Position pos = new Position(1, 0);
+                    m_STDRuleslist.Grid_Minerals[1, 0].Grid.Select();
+                    if (m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0].Value.ToString().Replace(" ", "").Trim() != "")
+                    {
+                        if (CheckAttributes())
+                        {
+                            if (Checktextbox_STDEditor())
+                            {
+                                FormForWaiting forWaiting = new FormForWaiting();
+                                forWaiting.Show();
+                                SaveDataOfSelRule(m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0);
+                                //SaveXmlTreeDataToXml(Address);
+                                bool result = SaveDictionaryToClassify(STDDBAddress);
+                                if (result)
+                                {
+                                    m_SubMidWindow.m_STDEditor.SaveSTDXray();
+                                    STDDictionaryInitial.Clear();
+                                    STDDictionaryInitial = new Dictionary<int, STDdata>(STDDictionary);
+                                    forWaiting.Close();
+                                    IsModified = false;
+                                    MessageBox.Show("Save successful!", "Tip");
+                                }
+                                else
+                                {
+                                    forWaiting.Close();
+                                    MessageBox.Show("Save failed!", "Tip");
+                                }
+                            }
+                        }
+                    }
+                }
+
+            }
+        }
+
+        /// <summary>
+        /// [颜色:RGB转成16进制]
+        /// </summary>
+        /// <param name="R">红 int</param>
+        /// <param name="G">绿 int</param>
+        /// <param name="B">蓝 int</param>
+        /// <returns></returns>
+        public static string colorRGBtoHx16(int R, int G, int B)
+        {
+            return System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(R, G, B));
+        }
+        //表达式规则检查
+        public bool Checktextbox_STDEditor()
+        {
+            string str_RemoveBlank = m_SubMidWindow.m_STDEditor.textbox_STDEditor.Text.ToString().Replace(" ", "");
+            if (str_RemoveBlank != "")
+            {
+                str_RemoveBlank = str_RemoveBlank.Replace("\r\n", "");
+                //分割符号检验
+                string[] Symbol = { "and", "or", "+", "-", "*", "/", "=", ">", "<" };
+                for (int i = 0; i < Symbol.Length; i++)
+                {
+                    for (int j = 0; j < Symbol.Length; j++)
+                    {
+                        if ((Symbol[i] + Symbol[j]) != ">=" && (Symbol[i] + Symbol[j]) != "<=")
+                        {
+                            if (str_RemoveBlank.Contains(Symbol[i] + Symbol[j]))
+                            {
+                                MessageBox.Show("Invalid string exists:" + Symbol[i] + Symbol[j], "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                                return false;
+                            }
+                        }
+                    }
+                    if (str_RemoveBlank.Contains(Symbol[i] + ")") || str_RemoveBlank.Contains("(" + Symbol[i]))
+                    {
+                        MessageBox.Show("Invalid string exists:" + Symbol[i] + ")", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                        return false;
+                    }
+                    if (str_RemoveBlank.Contains("(" + Symbol[i]))
+                    {
+                        MessageBox.Show("Invalid string exists:" + "(" + Symbol[i], "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                        return false;
+                    }
+                }
+                if ((str_RemoveBlank != null) && (str_RemoveBlank != ""))
+                {
+                    //左右括号匹配检验
+                    int BracketsNum = 0;
+                    for (int i = 0; i < str_RemoveBlank.Length; i++)
+                    {
+                        if (str_RemoveBlank[i] == '(') BracketsNum++;
+                        if (str_RemoveBlank[i] == ')') BracketsNum--;
+                    }
+                    if (BracketsNum != 0)
+                    {
+                        MessageBox.Show("Number of left and right parentheses does not match!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                        return false;
+                    }
+                    //首字符检测
+                    if ((str_RemoveBlank[0] == '+') || (str_RemoveBlank[0] == '-') || (str_RemoveBlank[0] == '*') || (str_RemoveBlank[0] == '/') || (str_RemoveBlank[0] == '>') || (str_RemoveBlank[0] == '<') || (str_RemoveBlank[0] == '=') || (str_RemoveBlank[0] == ')') || (str_RemoveBlank[str_RemoveBlank.Length - 1] == '('))
+                    {
+                        MessageBox.Show("First character is error!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                        return false;
+                    }
+
+                    if (str_RemoveBlank.Length >= 3)
+                    {
+                        if ((str_RemoveBlank.Substring(0, 3) == "and") || (str_RemoveBlank.Substring(0, 3) == "end"))
+                        {
+                            MessageBox.Show("First character is error!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                            return false;
+                        }
+                    }
+                }
+
+                //forth_elem干扰or分隔符,故先行去掉
+                str_RemoveBlank = str_RemoveBlank.Replace("forth_elem", "");
+
+                string[] str_Removeand = System.Text.RegularExpressions.Regex.Split(str_RemoveBlank, "and", System.Text.RegularExpressions.RegexOptions.None);
+                List<string> str_Removeandor = new List<string>();
+                for (int i = 0; i < str_Removeand.Length; i++)
+                {
+                    str_Removeandor.AddRange(System.Text.RegularExpressions.Regex.Split(str_Removeand[i], "or", System.Text.RegularExpressions.RegexOptions.None));
+                }
+                List<string> list_all = new List<string>();
+                for (int i = 0; i < str_Removeandor.Count; i++)
+                {
+                    list_all.AddRange(str_Removeandor[i].Split(new char[] { '+', '-', '*', '/', '=', '>', '<', '(', ')' }));
+                }
+
+                //常量
+                List<string> Constantslist = new List<string>();
+                for (int j = 0; j < m_SubMidWindow.m_STDEditor.comboBox_Constants.Items.Count; j++)
+                {
+                    Constantslist.Add(m_SubMidWindow.m_STDEditor.comboBox_Constants.Items[j].ToString().Split('=')[0]);
+                }
+
+                for (int i = 0; i < list_all.Count; i++)
+                {
+                    //周期元素?
+                    if (this.m_SubMidWindow.m_STDEditor.comboBox_PeriodicTable.Items.Contains(list_all[i]))
+                    {
+                        continue;
+                    }
+                    //first_elem?
+                    if (this.m_SubMidWindow.m_STDEditor.comboBox_Elem1.Items.Contains(list_all[i]))
+                    {
+                        continue;
+                    }
+                    //Element1?
+                    if (this.m_SubMidWindow.m_STDEditor.comboBox_Elem.Items.Contains(list_all[i]))
+                    {
+                        continue;
+                    }
+                    //其它元素?
+                    if (this.m_SubMidWindow.m_STDEditor.comboBox_ImgProperty.Items.Contains(list_all[i]))
+                    {
+                        continue;
+                    }
+                    //常量?
+                    if (Constantslist.Contains(list_all[i]))
+                    {
+                        continue;
+                    }
+                    //数字?
+                    double DNum = 0;
+                    if (double.TryParse(list_all[i], out DNum))
+                    {
+                        continue;
+                    }
+                    //>=? <=?等其它情况
+                    if (list_all[i] == "")
+                    {
+                        continue;
+                    }
+                    //true false?
+                    if ((list_all[i] == "true") || (list_all[i] == "false"))
+                    {
+                        continue;
+                    }
+
+                    MessageBox.Show("Please check whether the input rules are correct, error characters:" + list_all[i], "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    return false;
+                }
+                //检测是否有<>= true,false
+                if (!m_SubMidWindow.m_STDEditor.textbox_STDEditor.Text.ToString().Contains("<") && !m_SubMidWindow.m_STDEditor.textbox_STDEditor.Text.ToString().Contains(">") && !m_SubMidWindow.m_STDEditor.textbox_STDEditor.Text.ToString().Contains("=") && m_SubMidWindow.m_STDEditor.textbox_STDEditor.Text.ToString() != "true" && m_SubMidWindow.m_STDEditor.textbox_STDEditor.Text.ToString() != "false")
+                {
+                    MessageBox.Show("Expressions have no effect!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    return false;
+                }
+            }
+            else
+            {
+                var XrayInfo = m_SubMidWindow.m_STDEditor.m_STDXrayList.Find(STDXray => STDXray.StdID == m_STDRuleslist.Grid_Minerals[m_STDRuleslist.PreRow, 0].Tag.ToString());
+                if (XrayInfo==null||XrayInfo.XrayData==null)
+                {
+                    MessageBox.Show("Expressions cannot be empty!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        //属性检测
+        public bool CheckAttributes()
+        {
+            //if (double.Parse(m_Attributes.Grid_Attributes[4, 1].Value.ToString()) <= 0)
+            //{
+            //    Position pos = new Position(4, 1);
+            //    m_Attributes.Grid_Attributes.Selection.Focus(pos, true);
+            //    MessageBox.Show(table["message10"].ToString(), table["message32"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
+            //    return false;
+            //}
+            //if (double.Parse(m_Attributes.Grid_Attributes[5, 1].Value.ToString()) <= 0)
+            //{
+            //    Position pos = new Position(5, 1);
+            //    m_Attributes.Grid_Attributes.Selection.Focus(pos, true);
+            //    MessageBox.Show(table["message11"].ToString(), table["message32"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
+            //    return false;
+            //}
+            //if (double.Parse(m_Attributes.Grid_Attributes[6, 1].Value.ToString()) <= 0)
+            //{
+            //    Position pos = new Position(6, 1);
+            //    m_Attributes.Grid_Attributes.Selection.Focus(pos, true);
+            //    MessageBox.Show(table["message12"].ToString(), table["message32"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
+            //    return false;
+            //}
+            //if (int.Parse(m_Attributes.Grid_Attributes[7, 1].Value.ToString()) <= 0)
+            //{
+            //    Position pos = new Position(7, 1);
+            //    m_Attributes.Grid_Attributes.Selection.Focus(pos, true);
+            //    MessageBox.Show(table["message9"].ToString(), table["message32"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
+            //    return false;
+            //}
+            if (m_Attributes.Grid_Attributes[10, 1].Value != null)
+            {
+                if (!GroupIdDictionaryFromName.ContainsKey(m_Attributes.Grid_Attributes[10, 1].Value.ToString()))
+                {
+                    Position pos = new Position(10, 1);
+                    m_Attributes.Grid_Attributes.Selection.Focus(pos, true);
+                    MessageBox.Show("This group name is not included, please fill in again!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    return false;
+                }
+            }
+            #region 化学式和元素暂无限制
+            //if (m_Attributes.Grid_Attributes[7, 1].Value.ToString())
+            //{
+            //    Position pos = new Position(7, 1);
+            //    m_Attributes.Grid_Attributes.Selection.Focus(pos, true);
+            //    MessageBox.Show(table["message10"].ToString(), table["message32"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
+            //    return false;
+            //}
+
+            //if (m_Attributes.Grid_Attributes[8, 1].Value.ToString())
+            //{
+            //    Position pos = new Position(8, 1);
+            //    m_Attributes.Grid_Attributes.Selection.Focus(pos, true);
+            //    MessageBox.Show(table["message10"].ToString(), table["message32"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
+            //    return false;
+            //}
+            #endregion
+            return true;
+        }
+
+        public void SaveDataOfSelRule(int PreRow, int PreColumn)
+        {
+            STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].StrName = m_Attributes.Grid_Attributes[2, 1].Value.ToString();
+            STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Color = colorRGBtoHx16(m_Attributes.Grid_Attributes[3, 1].View.BackColor.R, m_Attributes.Grid_Attributes[3, 1].View.BackColor.G, m_Attributes.Grid_Attributes[3, 1].View.BackColor.B);
+            STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Hardness = m_Attributes.Grid_Attributes[4, 1].Value.ToString();
+            STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Density = m_Attributes.Grid_Attributes[5, 1].Value.ToString();
+            STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Electrical_conductivity = m_Attributes.Grid_Attributes[6, 1].Value.ToString();
+            STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].BSE = m_Attributes.Grid_Attributes[7, 1].Value.ToString();  
+            
+
+            if (m_Attributes.Grid_Attributes[8, 1].Value!= null)
+            {
+                STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Formula = m_Attributes.Grid_Attributes[8, 1].Value.ToString();
+            }
+            else
+            {
+                STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Formula = "";
+            }
+            if (m_Attributes.Grid_Attributes[9, 1].Value != null)
+            {
+                STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Element = m_Attributes.Grid_Attributes[9, 1].Value.ToString();
+            }
+            else
+            {
+                STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Element = "";
+            }
+
+            if (m_Attributes.Grid_Attributes[10, 1].Value != null)
+            {
+                STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].GroupId =  GroupIdDictionaryFromName[m_Attributes.Grid_Attributes[10, 1].Value.ToString()].ToString();
+            }
+            else
+            {
+                STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].GroupId = "0";
+            }
+
+            STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Expression = m_SubMidWindow.m_STDEditor.textbox_STDEditor.Text.ToString();
+
+            string sKeyElements = "";
+            for (int i = 0; i < m_SubMidWindow.m_STDEditor.dataGridView_KeyElements.Columns.Count; i++)
+            {
+                sKeyElements += m_SubMidWindow.m_STDEditor.dataGridView_KeyElements.Rows[0].Cells[i].Value.ToString() + ",";
+            }
+            if (sKeyElements.Length > 0)
+            {
+                sKeyElements = sKeyElements.Substring(0, sKeyElements.Length - 1);
+            }
+
+            string sSubElements = "";
+            for (int i = 0; i < m_SubMidWindow.m_STDEditor.dataGridView_SubElements.Columns.Count; i++)
+            {
+                sSubElements += m_SubMidWindow.m_STDEditor.dataGridView_SubElements.Rows[0].Cells[i].Value.ToString() + ",";
+            }
+            if (sSubElements.Length > 0)
+            {
+                sSubElements = sSubElements.Substring(0, sSubElements.Length - 1);
+            }
+
+            STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].KeyElementList = sKeyElements;
+            STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].SubElementList = sSubElements;
+        }
+
+        /// <summary>
+        /// 保存ClassifySTD库和MineralElements库
+        /// </summary>
+        /// <param name="DBAddress"></param>
+        /// <returns></returns>
+        bool SaveDictionaryToClassify(string DBAddress)
+        {
+            //保存列表顺序
+           for(int i=1;i<m_STDRuleslist.Grid_Minerals.RowsCount;i++)
+            {
+                STDDictionary[(int)m_STDRuleslist.Grid_Minerals[i,0].Tag].ListNum = i.ToString();
+            }
+            try
+            {
+                System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + DBAddress + "'");
+                m_dbConnection.Open();
+
+                System.Data.SQLite.SQLiteCommand cmm = m_dbConnection.CreateCommand();
+                cmm.CommandText = "delete from ClassifySTD";
+                //cmm.CommandText = "delete from ClassifySTD_Backup";
+                try
+                {
+                    cmm.ExecuteNonQuery();
+                }
+                catch (Exception ex)
+                {
+                    MessageBox.Show(ex.ToString());
+                    return false;
+                }
+
+
+                System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from ClassifySTD", m_dbConnection);
+                //System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from ClassifySTD_Backup", m_dbConnection);
+                System.Data.SQLite.SQLiteCommandBuilder qLiteCommandBuilder = new System.Data.SQLite.SQLiteCommandBuilder(m_dataAdapter);
+
+                DataSet ds = new DataSet();
+                m_dataAdapter.Fill(ds, "ClassifySTD");
+                DataTable dt = ds.Tables["ClassifySTD"];
+
+                //m_dataAdapter.Fill(ds, "ClassifySTD_Backup");
+                //DataTable dt = ds.Tables["ClassifySTD_Backup"];
+
+                dt.Clear();
+                foreach (KeyValuePair<int, STDdata> kv in STDDictionary)
+                {
+                    string UsingElementList = "";
+                    string UsingImgPropertyList = "";
+                    string UsingOtherPropertyList = "";
+                    List<string> UsingElementL = new List<string>();
+                    List<string> UsingImgPropertyL = new List<string>();
+                    List<string> UsingOtherPropertyL = new List<string>();
+
+                    string str_RemoveBlank = kv.Value.Expression;
+                    //forth_elem干扰or分隔符,故先行去掉
+                    if (str_RemoveBlank.Contains("forth_elem"))
+                    {
+                        str_RemoveBlank = str_RemoveBlank.Replace("forth_elem", "");
+                        UsingOtherPropertyList = "forth_elem,";
+                    }
+
+                    str_RemoveBlank = str_RemoveBlank.Replace(" ", "");
+                    string[] str_Removeand = System.Text.RegularExpressions.Regex.Split(str_RemoveBlank, "and", System.Text.RegularExpressions.RegexOptions.None);
+                    List<string> str_Removeandor = new List<string>();
+                    for (int i = 0; i < str_Removeand.Length; i++)
+                    {
+                        str_Removeandor.AddRange(System.Text.RegularExpressions.Regex.Split(str_Removeand[i], "or", System.Text.RegularExpressions.RegexOptions.None));
+                    }
+                    List<string> list_all = new List<string>();
+                    for (int i = 0; i < str_Removeandor.Count; i++)
+                    {
+                        list_all.AddRange(str_Removeandor[i].Split(new char[] { '+', '-', '*', '/', '=', '>', '<', '(', ')' }));
+                    }
+                    for (int i = 0; i < list_all.Count; i++)
+                    {
+                        //周期元素?
+                        if (m_SubMidWindow.m_STDEditor.comboBox_PeriodicTable.Items.Contains(list_all[i]))
+                        {
+                            if (!UsingElementL.Contains(list_all[i]))
+                            {
+                                UsingElementL.Add(list_all[i]);
+                            }
+                        }
+                        //first_elem?
+                        if (m_SubMidWindow.m_STDEditor.comboBox_Elem1.Items.Contains(list_all[i]))
+                        {
+                            if (!UsingOtherPropertyL.Contains(list_all[i]))
+                            {
+                                UsingOtherPropertyL.Add(list_all[i]);
+                            }
+                        }
+                        //Element1?
+                        if (m_SubMidWindow.m_STDEditor.comboBox_Elem.Items.Contains(list_all[i]))
+                        {
+                            if (!UsingOtherPropertyL.Contains(list_all[i]))
+                            {
+                                UsingOtherPropertyL.Add(list_all[i]);
+                            }
+                        }
+                        //其它元素?
+                        if (m_SubMidWindow.m_STDEditor.comboBox_ImgProperty.Items.Contains(list_all[i]))
+                        {
+                            if (!UsingImgPropertyL.Contains(list_all[i]))
+                            {
+                                UsingImgPropertyL.Add(list_all[i]);
+                            }
+                        }
+                    }
+                    if (UsingElementL.Count > 0)
+                    {
+                        for (int i = 0; i < UsingElementL.Count - 1; i++)
+                        {
+                            UsingElementList += UsingElementL[i] + ",";
+                        }
+                        UsingElementList += UsingElementL[UsingElementL.Count - 1];
+                    }
+
+                    if (UsingImgPropertyL.Count > 0)
+                    {
+                        for (int i = 0; i < UsingImgPropertyL.Count - 1; i++)
+                        {
+                            UsingImgPropertyList += UsingImgPropertyL[i] + ",";
+                        }
+                        UsingImgPropertyList += UsingImgPropertyL[UsingImgPropertyL.Count - 1];
+                    }
+
+                    if (UsingOtherPropertyL.Count > 0)
+                    {
+                        for (int i = 0; i < UsingOtherPropertyL.Count - 1; i++)
+                        {
+                            UsingOtherPropertyList += UsingOtherPropertyL[i] + ",";
+                        }
+                        UsingOtherPropertyList += UsingOtherPropertyL[UsingOtherPropertyL.Count - 1];
+                    }
+
+                    DataRow newRow = dt.NewRow();
+                    newRow["STDId"] = kv.Key;
+                    newRow["StrName"] = kv.Value.StrName;
+                    newRow["Color"] = kv.Value.Color;
+                    newRow["KeyElementList"] = kv.Value.KeyElementList;
+                    newRow["SubElementList"] = kv.Value.SubElementList;
+                    newRow["UsingImgPropertyList"] = UsingImgPropertyList;
+                    newRow["UsingOtherPropertyList"] = UsingOtherPropertyList;
+                    newRow["Expression"] = kv.Value.Expression;
+                    newRow["Hardness"] = kv.Value.Hardness;
+                    newRow["Density"] = kv.Value.Density;
+                    newRow["Electrical_conductivity"] = kv.Value.Electrical_conductivity;
+                    newRow["BSE"] = int.Parse(kv.Value.BSE);
+                    newRow["Formula"] = kv.Value.Formula;
+                    newRow["Element"] = kv.Value.Element;
+                    newRow["GroupId"] = int.Parse(kv.Value.GroupId);
+                    newRow["ListNum"] = kv.Value.ListNum;
+                    dt.Rows.Add(newRow);
+                }
+                m_dataAdapter.Update(ds,"ClassifySTD");
+                m_dbConnection.Close();
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.ToString());
+                return false;
+            }
+            return true;
+        }
+
+        public int AddSTDDictionaryItem()
+        {
+            STDdata new_STDdata = new STDdata();//定义一个TreeNode节点对象
+            new_STDdata.Hardness = "1";
+            new_STDdata.Density = "1";
+            new_STDdata.Electrical_conductivity = "1";
+            new_STDdata.BSE = "1";
+            new_STDdata.Formula = "1";
+            new_STDdata.Element = "1";
+            new_STDdata.StrName = "NewRuleName";
+            //new_STDdata.Expression = "NewRules";
+            new_STDdata.Expression = "";
+            new_STDdata.KeyElementList = "";
+            new_STDdata.SubElementList = "";
+
+            new_STDdata.Color = colorRGBtoHx16(Color.Gray.R, Color.Gray.G, Color.Gray.B);
+
+            int STDId = 40000;
+
+            foreach (KeyValuePair<int, STDdata> kv in STDDictionary)
+            {
+                if (STDId < kv.Key)
+                {
+                    STDId = kv.Key;
+                }
+            }
+
+            STDDictionary.Add(STDId + 1, new_STDdata);
+
+            return STDId + 1;
+        }
+
+        public void RemoveSTDDictionaryItem(int STDId)
+        {
+            STDDictionary.Remove(STDId);
+        }
+
+        public void ChangeStrName(int RowNum, string NewStrName)
+        {
+            STDDictionary[(int)m_STDRuleslist.Grid_Minerals[RowNum, 0].Tag].StrName = NewStrName;
+            m_Attributes.Grid_Attributes[2, 1].Value = NewStrName;
+        }
+
+        public void ChangeSTDRulesLISTBackColor()
+        {
+            int stdid=m_STDRuleslist.ChangeSTDRulesLISTBackColor();
+            if (stdid != -1)
+            {
+                m_SubMidWindow.m_STDEditor.SelSTDXray(stdid, STDDictionary[stdid]);
+            }
+        }
+        public void ChangeSTDRuleName(String RuleName)
+        {
+            m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0].Value = RuleName;
+        }
+
+        public void SetNull()
+        {
+            m_SubMidWindow.m_STDEditor.textbox_STDEditor.Text = "";
+            for (int i = 1; i<m_Attributes.Grid_Attributes.RowsCount-1; i++)
+            {
+                m_Attributes.Grid_Attributes[i, 1].Value = "";
+            }
+
+            SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
+            view.BackColor = Color.White;
+            m_Attributes.Grid_Attributes[2, 1].View= view;
+
+            m_SubMidWindow.m_STDEditor.dataGridView_KeyElements.Rows.Clear();
+            m_SubMidWindow.m_STDEditor.dataGridView_KeyElements.Columns.Clear();
+            m_SubMidWindow.m_STDEditor.dataGridView_SubElements.Rows.Clear();
+            m_SubMidWindow.m_STDEditor.dataGridView_SubElements.Columns.Clear();
+        }
+
+        private void ribbon_ESDMaxRules_Click(object sender, EventArgs e)
+        {
+            Form_MaxEDSRules form_MaxEDSRules = new Form_MaxEDSRules(STDDBAddress);
+            form_MaxEDSRules.Show();
+        }
+
+        private void ribbon_ZeroRules_Click(object sender, EventArgs e)
+        {
+            Form_ZeroElementRules form_ZeroElementRules = new Form_ZeroElementRules(STDDBAddress);
+            form_ZeroElementRules.Show();
+        }
+
+        private void ribbon_UserConstants_Click(object sender, EventArgs e)
+        {
+            Form_UserConstants form_UserConstants = new Form_UserConstants(STDDBAddress);
+            DialogResult dialogResult=form_UserConstants.ShowDialog();
+            if (dialogResult == DialogResult.Yes)
+            {
+                try
+                {
+                    System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + STDDBAddress + "'");
+                    m_dbConnection.Open();
+                    System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select value from Constants", m_dbConnection);
+                    DataSet ds = new DataSet();
+                    m_dataAdapter.Fill(ds);
+                    DataTable dt = ds.Tables[0];
+                    string ConstantsStr = dt.Rows[0][0].ToString();
+                    ConstantsStr = ConstantsStr.Replace(" ", "");
+                    string[] ConstantsStr2 = ConstantsStr.Split(',');
+                    m_SubMidWindow.m_STDEditor.comboBox_Constants.Items.Clear();
+                    m_SubMidWindow.m_STDEditor.comboBox_Constants.Items.AddRange(ConstantsStr2);
+                    m_dbConnection.Close();
+                }
+                catch (Exception ee)
+                {
+                    MessageBox.Show(ee.ToString());
+                }
+            }
+        }
+
+
+        public void AddSTDGroupsToAttribute()
+        {
+            try
+            {
+                System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + STDDBAddress + "'");
+                m_dbConnection.Open();
+                System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select name,id from STDGroups order by iorder", m_dbConnection);
+                DataSet ds = new DataSet();
+                m_dataAdapter.Fill(ds);
+                DataTable dt = ds.Tables[0];
+                if (dt != null)
+                {
+                    if (dt.Rows.Count >= 0)
+                    {
+                        GroupIdDictionaryFromId.Clear();
+                        GroupIdDictionaryFromName.Clear();
+                        if (dt.Select("id='0'").Length==0)
+                        {
+                            GroupIdDictionaryFromId.Add(0, "Default");
+                            GroupIdDictionaryFromName.Add("Default", 0);
+                        }
+
+                        List<string> ss = new List<string>();
+                        foreach (DataRow item in dt.Rows)
+                        {
+                            ss.Add(item["name"].ToString());
+                            GroupIdDictionaryFromName.Add(item["name"].ToString(), int.Parse(item["id"].ToString()));
+                            GroupIdDictionaryFromId.Add(int.Parse(item["id"].ToString()),item["name"].ToString());
+                        }
+                        SourceGrid.Cells.Editors.ComboBox GroupIdCBBox = new SourceGrid.Cells.Editors.ComboBox(typeof(string));
+                        GroupIdCBBox.StandardValues = ss;
+                        GroupIdCBBox.EditableMode = SourceGrid.EditableMode.SingleClick| SourceGrid.EditableMode.Focus;
+                        m_Attributes.Grid_Attributes[10, 1] = new SourceGrid.Cells.Cell("Default", GroupIdCBBox);
+                    }
+                }
+                //string ConstantsStr = dt.Rows[0][0].ToString();
+                m_dbConnection.Close();
+            }
+            catch (Exception ee)
+            {
+                MessageBox.Show(ee.ToString());
+            }
+        }
+
+        void SetNonexistentGroupsToDefault()
+        {
+            foreach (KeyValuePair<int, STDdata> kv in STDDictionary)
+            {
+                if(!GroupIdDictionaryFromId.Keys.Contains(int.Parse(kv.Value.GroupId)))
+                {
+                    kv.Value.GroupId = "0";
+                }
+            }
+            m_Attributes.Grid_Attributes.Refresh();
+        }
+        private void ribbon_GroupNameMaintenance_Click(object sender, EventArgs e)
+        {
+            //STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0].Tag.ToString())].GroupId = GroupIdDictionaryFromName[m_Attributes.Grid_Attributes[10, 1].Value.ToString()].ToString();
+            int selGroupId = GroupIdDictionaryFromName[m_Attributes.Grid_Attributes[10, 1].Value.ToString()];
+            Form_GroupId form_GroupId = new Form_GroupId(STDDBAddress,this);
+            DialogResult dialogResult = form_GroupId.ShowDialog();
+            if (dialogResult == DialogResult.Yes)
+            {
+                AddSTDGroupsToAttribute();
+                //SetNonexistentGroupsToDefault();
+                m_Attributes.Grid_Attributes[10, 1].Value = GroupIdDictionaryFromId[selGroupId];
+            }
+        }
+
+        private void ribbon_Exit_Click(object sender, EventArgs e)
+        {
+            this.Close();
+        }
+
+
+        #region XML文档部分代码
+        //string Address = Application.StartupPath + "\\Config\\SysData\\OTSParticleSTD.xml";
+        //string Address_backup = Application.StartupPath + "\\Config\\SysData\\OTSParticleSTD_backup.xml";
+        //private void Form_ConstantsEditor2_Load(object sender, EventArgs e)
+        //{
+        //    //XmlDocument doc = new XmlDocument();
+        //    //doc.Load(Address);
+        //    //doc.Load(Address_backup);
+        //    //LoadXmlToDictionary(doc, ref STDDictionary);
+        //}
+        //private void rbRecover_Click(object sender, EventArgs e)
+        //{
+        //    try
+        //    {
+
+        //        //System.IO.File.Copy(Address_backup, Address, true);
+        //        //XmlDocument doc = new XmlDocument();
+        //        //doc.Load(Address);
+        //        //LoadXmlToDictionary(doc, ref STDDictionary);
+        //    }
+        //}
+        //void LoadXmlToDictionary(XmlDocument xml, ref Dictionary<int, STDdata> STDDictionary)
+        //{
+        //    XmlNode root = xml.SelectSingleNode("XMLData");
+        //    XmlNodeList root2 = root.SelectNodes("Collection");
+
+        //    for (int j = 0; j < root2.Count; j++)
+        //    {
+        //        if (root2[j].Attributes["RegName"].Value.ToString() == "STDList")
+        //        {
+        //            XmlNodeList childlist = root2[j].ChildNodes;
+
+        //            for (int i = 0; i < childlist.Count; i++)
+        //            {
+
+        //                //BSE、化学式、元素
+        //                string strBseValue = string.Empty;
+        //                string strFormula = string.Empty;
+        //                string strElement = string.Empty;
+        //                if (childlist[i].Attributes["BSE"] != null)
+        //                {
+        //                    strBseValue = childlist[i].Attributes["BSE"].Value;
+        //                }
+        //                if (childlist[i].Attributes["Formula"] != null)
+        //                {
+        //                    strFormula = childlist[i].Attributes["Formula"].Value;
+        //                }
+        //                if (childlist[i].Attributes["Element"] != null)
+        //                {
+        //                    strElement = childlist[i].Attributes["Element"].Value;
+        //                }
+
+
+        //                STDdata new_STDdata = new STDdata();//定义一个TreeNode节点对象
+        //                new_STDdata.Hardness = childlist[i].Attributes["Hardness"].Value;
+        //                new_STDdata.Density = childlist[i].Attributes["Density"].Value;
+        //                new_STDdata.Electrical_conductivity = childlist[i].Attributes["Electrical_conductivity"].Value;
+        //                new_STDdata.BSE = strBseValue;
+        //                new_STDdata.Formula = strFormula;
+        //                new_STDdata.Element = strElement;
+        //                new_STDdata.StrName = childlist[i].Attributes["StrName"].Value;
+        //                new_STDdata.Expression = childlist[i].Attributes["Expression"].Value;
+        //                new_STDdata.STDId = childlist[i].Attributes["STDId"].Value;
+        //                new_STDdata.Color = childlist[i].Attributes["Color"].Value;
+        //                new_STDdata.KeyElementList = childlist[i].Attributes["KeyElementList"].Value;
+        //                new_STDdata.SubElementList = childlist[i].Attributes["SubElementList"].Value;
+
+
+
+        //                STDDictionary.Add(int.Parse(childlist[i].Attributes["STDId"].Value), new_STDdata);
+        //            }
+        //        }
+        //    }
+
+        //    XmlNode root3 = root.SelectSingleNode("Member");
+        //    string ConstantsStr = root3.Attributes["value"].Value;
+        //    ConstantsStr = ConstantsStr.Replace(" ", "");
+        //    string[] ConstantsStr2 = ConstantsStr.Split(',');
+        //    m_SubMidWindow.m_STDEditor.comboBox_Constants.Items.Clear();
+        //    m_SubMidWindow.m_STDEditor.comboBox_Constants.Items.AddRange(ConstantsStr2);
+        //}
+
+        ////保存xmltree内容到xml文件
+        //void SaveXmlTreeDataToXml(string Address)
+        //{
+        //    #region text
+        //    //XElement xele = XElement.Load(Address);
+        //    //var item = (from ele1 in xele.Elements("Collection")
+        //    //            where ele1.Attribute("RegName").Value.Equals("STDList")
+        //    //            select ele1).FirstOrDefault();
+
+        //    //if (item != null)
+        //    //{
+        //    //    item.Remove();
+        //    //}
+
+        //    //xele.Save(Address);
+        //    #endregion
+        //    XDocument xdoc = XDocument.Load(Address);
+        //    IEnumerable<XElement> elements = from ele in xdoc.Descendants("XMLData") select ele;
+        //    var item = (from ele1 in elements.Elements("Collection")
+        //                where ele1.Attribute("RegName").Value.Equals("STDList")
+        //                select ele1).FirstOrDefault();
+        //    if (item != null)
+        //    {
+        //        item.Remove();
+        //    }
+
+        //    XElement STD = new XElement("Collection");
+        //    STD.SetAttributeValue("RegName", "STDList");
+        //    elements.ElementAt(0).Add(STD);
+
+        //    foreach (KeyValuePair<int, STDdata> kv in STDDictionary)
+        //    {
+        //        string UsingElementList = "";
+        //        string UsingImgPropertyList = "";
+        //        string UsingOtherPropertyList = "";
+        //        List<string> UsingElementL = new List<string>();
+        //        List<string> UsingImgPropertyL = new List<string>();
+        //        List<string> UsingOtherPropertyL = new List<string>();
+
+        //        string str_RemoveBlank = kv.Value.Expression;
+        //        //forth_elem干扰or分隔符,故先行去掉
+        //        if (str_RemoveBlank.Contains("forth_elem"))
+        //        {
+        //            str_RemoveBlank = str_RemoveBlank.Replace("forth_elem", "");
+        //            UsingOtherPropertyList = "forth_elem,";
+        //        }
+
+        //        str_RemoveBlank = str_RemoveBlank.Replace(" ", "");
+        //        string[] str_Removeand = System.Text.RegularExpressions.Regex.Split(str_RemoveBlank, "and", System.Text.RegularExpressions.RegexOptions.None);
+        //        List<string> str_Removeandor = new List<string>();
+        //        for (int i = 0; i < str_Removeand.Length; i++)
+        //        {
+        //            str_Removeandor.AddRange(System.Text.RegularExpressions.Regex.Split(str_Removeand[i], "or", System.Text.RegularExpressions.RegexOptions.None));
+        //        }
+        //        List<string> list_all = new List<string>();
+        //        for (int i = 0; i < str_Removeandor.Count; i++)
+        //        {
+        //            list_all.AddRange(str_Removeandor[i].Split(new char[] { '+', '-', '*', '/', '=', '>', '<', '(', ')' }));
+        //        }
+        //        for (int i = 0; i < list_all.Count; i++)
+        //        {
+        //            //周期元素?
+        //            if (m_SubMidWindow.m_STDEditor.comboBox_PeriodicTable.Items.Contains(list_all[i]))
+        //            {
+        //                if (!UsingElementL.Contains(list_all[i]))
+        //                {
+        //                    UsingElementL.Add(list_all[i]);
+        //                }
+        //            }
+        //            //first_elem?
+        //            if (m_SubMidWindow.m_STDEditor.comboBox_Elem1.Items.Contains(list_all[i]))
+        //            {
+        //                if (!UsingOtherPropertyL.Contains(list_all[i]))
+        //                {
+        //                    UsingOtherPropertyL.Add(list_all[i]);
+        //                }
+        //            }
+        //            //Element1?
+        //            if (m_SubMidWindow.m_STDEditor.comboBox_Elem.Items.Contains(list_all[i]))
+        //            {
+        //                if (!UsingOtherPropertyL.Contains(list_all[i]))
+        //                {
+        //                    UsingOtherPropertyL.Add(list_all[i]);
+        //                }
+        //            }
+        //            //其它元素?
+        //            if (m_SubMidWindow.m_STDEditor.comboBox_ImgProperty.Items.Contains(list_all[i]))
+        //            {
+        //                if (!UsingImgPropertyL.Contains(list_all[i]))
+        //                {
+        //                    UsingImgPropertyL.Add(list_all[i]);
+        //                }
+        //            }
+        //        }
+        //        if (UsingElementL.Count > 0)
+        //        {
+        //            for (int i = 0; i < UsingElementL.Count - 1; i++)
+        //            {
+        //                UsingElementList += UsingElementL[i] + ",";
+        //            }
+        //            UsingElementList += UsingElementL[UsingElementL.Count - 1];
+        //        }
+
+        //        if (UsingImgPropertyL.Count > 0)
+        //        {
+        //            for (int i = 0; i < UsingImgPropertyL.Count - 1; i++)
+        //            {
+        //                UsingImgPropertyList += UsingImgPropertyL[i] + ",";
+        //            }
+        //            UsingImgPropertyList += UsingImgPropertyL[UsingImgPropertyL.Count - 1];
+        //        }
+
+        //        if (UsingOtherPropertyL.Count > 0)
+        //        {
+        //            for (int i = 0; i < UsingOtherPropertyL.Count - 1; i++)
+        //            {
+        //                UsingOtherPropertyList += UsingOtherPropertyL[i] + ",";
+        //            }
+        //            UsingOtherPropertyList += UsingOtherPropertyL[UsingOtherPropertyL.Count - 1];
+        //        }
+
+        //        XElement EleName = new XElement("Member");
+        //        EleName.SetAttributeValue("STDId", kv.Key);
+        //        EleName.SetAttributeValue("StrName", kv.Value.StrName);
+        //        EleName.SetAttributeValue("Color", kv.Value.Color);
+        //        //EleName.SetAttributeValue("UsingElementList", UsingElementList);
+        //        EleName.SetAttributeValue("KeyElementList", kv.Value.KeyElementList);
+        //        EleName.SetAttributeValue("SubElementList", kv.Value.SubElementList);
+        //        EleName.SetAttributeValue("UsingImgPropertyList", UsingImgPropertyList);
+        //        EleName.SetAttributeValue("UsingOtherPropertyList", UsingOtherPropertyList);
+        //        EleName.SetAttributeValue("Expression", kv.Value.Expression);
+        //        EleName.SetAttributeValue("Hardness", kv.Value.Hardness);
+        //        EleName.SetAttributeValue("Density", kv.Value.Density);
+        //        EleName.SetAttributeValue("Electrical_conductivity", kv.Value.Electrical_conductivity);
+        //        EleName.SetAttributeValue("BSE", kv.Value.BSE);
+        //        EleName.SetAttributeValue("Formula", kv.Value.Formula);
+        //        EleName.SetAttributeValue("Element", kv.Value.Element);
+
+        //        STD.Add(EleName);
+        //    }
+        //    xdoc.Save(Address);
+        //}
+        #endregion
+
+        private void rbClose_Click(object sender, EventArgs e)
+        {            
+            if (!EqualsBetweenDictionary(STDDictionaryInitial, STDDictionary) || IsModified)
+            {
+                DialogResult dr = MessageBox.Show("Whether to save the current modification?", "Tip", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
+                if (dr == DialogResult.Yes)
+                {
+                    if (m_STDRuleslist.Grid_Minerals.RowsCount > 1)
+                    {
+                        if ((m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0].Value.ToString().Replace(" ", "").Trim() != "") && CheckAttributes() && Checktextbox_STDEditor())
+                        {
+                            SaveDataOfSelRule(m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0);
+                        }
+                        else
+                        {
+                            return;
+                        }
+
+                    }
+                    else
+                    {
+                        STDDictionaryInitial.Clear();
+                    }
+                    FormForWaiting forWaiting = new FormForWaiting();
+                    forWaiting.Show();
+                    bool result = SaveDictionaryToClassify(STDDBAddress);
+                    if (result)
+                    {
+                        m_SubMidWindow.m_STDEditor.SaveSTDXray();
+                        forWaiting.Close();
+                    }
+                    else
+                    {
+                        forWaiting.Close();
+                        MessageBox.Show("Save failed!", "Tip");
+                    }
+                }
+            }
+            m_Attributes.Close();
+            m_STDRuleslist.Close();
+            m_SubMidWindow.m_STDEditor.Close();
+            m_SubMidWindow.m_ComparativeLibrary.Close();
+            m_SubMidWindow.Close();
+            ButtonStatusClose();
+            if (this.Text.Split(' ').Count() != 0)
+            {
+                this.Text = this.Text.Split(' ')[0];
+            }
+        }
+
+        private void rbOpen_Click(object sender, EventArgs e)
+        {
+            OpenFileDialog openFileDialog = new OpenFileDialog();
+            openFileDialog.Filter = "(*.db)|*.db";
+            openFileDialog.RestoreDirectory = true;
+            openFileDialog.InitialDirectory = Application.StartupPath + "\\Config\\SysData\\";
+            openFileDialog.FilterIndex = 1;
+            if (openFileDialog.ShowDialog() == DialogResult.OK)
+            {
+                try
+                {
+                    STDDBAddress = openFileDialog.FileName;
+                    InitForms(STDDBAddress);
+                    this.Text = this.Text.Split(' ')[0] + "   " + STDDBAddress;
+                    IsModified = false;
+                }
+                catch
+                {
+                    MessageBox.Show("The selected standard library is formatted incorrectly, please open the correct standard library!", "Tip");
+                }
+            }
+        }
+
+        void ButtonStatusOpen()
+        {
+            rbOpen.Enabled = false;
+            rbClose.Enabled = true;
+            //rbRecover.Enabled = true;
+            rbBackup.Enabled = true;
+            rbSave.Enabled = true;
+            rbNew.Enabled = false;
+            ribbon_ZeroRules.Enabled = true;
+            ribbon_ESDMaxRules.Enabled = true;
+            ribbon_UserConstants.Enabled = true;
+            ribbon_GroupNameMaintenance.Enabled = true;
+            ribbon_BulkImport.Enabled = true;
+        }
+
+
+        void ButtonStatusClose()
+        {
+            rbOpen.Enabled = true;
+            rbClose.Enabled = false;
+            //rbRecover.Enabled = false;
+            rbBackup.Enabled = false;
+            rbSave.Enabled = false;
+            rbNew.Enabled = true;
+            ribbon_ZeroRules.Enabled = false;
+            ribbon_ESDMaxRules.Enabled = false;
+            ribbon_UserConstants.Enabled = false;
+            ribbon_GroupNameMaintenance.Enabled = false;
+            ribbon_BulkImport.Enabled = false;
+        }
+
+        void InitForms(string DBAddress)
+        {
+            STDDictionary.Clear();
+            bool ret = LoadClassifyToDictionary(DBAddress, ref STDDictionary);
+            STDDictionaryInitial = Clone(STDDictionary) as Dictionary<int, STDdata>;
+            if (!ret)
+            {
+                return;
+            }
+            ButtonStatusOpen();
+
+            m_STDRuleslist = new STDRuleslist(this);
+            m_Attributes = new Attributes(this);
+            m_SubMidWindow = new SubMidWindow(this);
+            m_DockWindow = new OTSDockWindow(this);
+
+            m_DockWindow.CreateMainWindow();
+
+            if (m_SubMidWindow.m_STDEditor.m_sc != null)
+            {
+                m_SubMidWindow.m_STDEditor.m_sc.CloseDB();
+            }
+            
+            m_SubMidWindow.m_STDEditor.m_sc = new SqlLiteClass(DBAddress);
+
+            LoadConstants(DBAddress);
+            AddSTDGroupsToAttribute();
+            m_SubMidWindow.m_STDEditor.textbox_STDEditor.Text = "";
+
+            if (m_STDRuleslist.Grid_Minerals.RowsCount > 1)
+            {
+                m_STDRuleslist.button_UpOrder.Enabled = false;
+                if (m_STDRuleslist.Grid_Minerals.RowsCount == 2)       //就一条时向下按钮置灰
+                {
+                    m_STDRuleslist.button_DownOrder.Enabled = false;
+                }
+                ChangeSTDEditorAndGrid_Attributes(int.Parse(m_STDRuleslist.Grid_Minerals[1, 0].Tag.ToString()));
+                Position pos = new Position(1, 0);
+                m_STDRuleslist.Grid_Minerals[1, 0].Grid.Select();
+                m_STDRuleslist.Grid_Minerals.Selection.Focus(pos, true);
+            }
+        }
+
+        private void ribbon_BulkImport_Click(object sender, EventArgs e)
+        {
+            OpenFileDialog openFileDialog = new OpenFileDialog();
+            openFileDialog.Filter = "(*.db)|*.db";
+            openFileDialog.RestoreDirectory = true;
+            openFileDialog.FilterIndex = 1;
+            openFileDialog.Title = "Please open a database!";
+            if (openFileDialog.ShowDialog() == DialogResult.OK)
+            {
+                try
+                {
+                    System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + openFileDialog.FileName + "'");
+                    m_dbConnection.Open();
+
+                    if(STDDictionary.Count==0)
+                    {
+                        MessageBox.Show(table["message27"].ToString(), "Tip");
+                        return;
+                    }
+
+                    string STDId = m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row,m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Column].Tag.ToString();
+
+                    bool ret = false;//搜索结果
+                    for(int i=0;i< STDDictionary.Count;i++)
+                    {
+                        STDEditor.Result result = m_SubMidWindow.m_STDEditor.ImportFromResult(STDDictionary.Keys.ElementAt(i).ToString(), m_dbConnection);
+                        if (result == STDEditor.Result.Success)
+                        {
+                            ret = true;
+                        }
+                        else if(result == STDEditor.Result.Fail)
+                        {
+                            return;
+                        }
+                    }
+                    if (!ret)
+                    {
+                        MessageBox.Show("No matching energy spectrum data was found", "Tip");
+                    }
+
+                    int color = Convert.ToInt32(m_SubMidWindow.m_STDEditor.ParseRGB(STDRuleslist.colorHx16toRGB(STDDictionary[int.Parse(STDId)].Color)).ToString());
+                    for (int j = 0; j < m_SubMidWindow.m_STDEditor.m_STDXrayList.Count; j++)
+                    {
+                        if (m_SubMidWindow.m_STDEditor.m_STDXrayList[j].StdID == STDId)
+                        {
+                            m_SubMidWindow.m_STDEditor.ShowXrayAtlas(color, m_SubMidWindow.m_STDEditor.m_STDXrayList[j].XrayData);
+                            break;
+                        }
+                    }
+                    m_dbConnection.Close();
+                }
+                catch(Exception ex)
+                {
+                    MessageBox.Show(ex.ToString());
+                }
+            }
+        }
+
+        bool EqualsBetweenDictionary(Dictionary<int, STDdata> STDDictionaryInitial, Dictionary<int, STDdata> STDDictionary)
+        {
+           if(STDDictionaryInitial.Count!= STDDictionary.Count)
+            {
+                return false;
+            }
+           
+           foreach(var key in STDDictionaryInitial.Keys)
+            {
+                if (STDDictionary.Keys.Contains(key))
+                {
+                    if(!STDDictionaryInitial[key].Equals(STDDictionary[key]))
+                    {
+                        return false;
+                    }
+                }
+                else
+                {
+                    return false;
+                }
+            }
+
+            return true;
+        }
+
+        private void Form_ConstantsEditor2_FormClosing(object sender, FormClosingEventArgs e)
+        {
+            if (m_STDRuleslist.Text != "")
+            {
+                if (!EqualsBetweenDictionary(STDDictionaryInitial, STDDictionary)|| IsModified)
+                {
+                    DialogResult dr = MessageBox.Show("Whether to save the current modification", "Tip", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
+                    if (dr == DialogResult.Yes)
+                    {
+                        if (m_STDRuleslist.Grid_Minerals.RowsCount > 1)
+                        {
+                            if ((m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0].Value.ToString().Replace(" ", "").Trim() != "") && CheckAttributes() && Checktextbox_STDEditor())
+                            {
+                                SaveDataOfSelRule(m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0);
+                            }
+                            else
+                            {
+                                e.Cancel = true;
+                                return;
+                            }
+
+                        }
+                        else
+                        {
+                            STDDictionaryInitial.Clear();
+                        }
+                        FormForWaiting forWaiting = new FormForWaiting();
+                        forWaiting.Show();
+                        bool result = SaveDictionaryToClassify(STDDBAddress);
+                        if (result)
+                        {
+                            m_SubMidWindow.m_STDEditor.SaveSTDXray();
+                            forWaiting.Close();
+                        }
+                        else
+                        {
+                            forWaiting.Close();
+                            MessageBox.Show("Save failed!", "Tip");
+                        }
+                    }
+                    else
+                    {
+                        foreach (KeyValuePair<int, STDdata> kv in STDDictionary)
+                        {
+                            if (!GroupIdDictionaryFromId.Keys.Contains(int.Parse(kv.Value.GroupId)))
+                            {
+                                MessageBox.Show("There is non-existent grouping informations in the classification, please adjust!");
+                                e.Cancel = true;
+                                return;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        private void ribbon_ConvertOreDatabaseToOtsDatabase_Click(object sender, EventArgs e)
+        {
+            DataTable OreDatabasedt = new DataTable();
+            OpenFileDialog openFileDialog = new OpenFileDialog();
+            openFileDialog.Title= "Please select the database you want to convert";
+            openFileDialog.Filter = "(*.db)|*.db";
+            openFileDialog.RestoreDirectory = true;
+            openFileDialog.FilterIndex = 1;
+            if (openFileDialog.ShowDialog() == DialogResult.OK)
+            {
+                try
+                {
+                    string OreDatabaseAddress = openFileDialog.FileName;
+                    System.Data.SQLite.SQLiteConnection m_OreDatabaseConnection = new System.Data.SQLite.SQLiteConnection("data source='" + OreDatabaseAddress + "'");
+                    m_OreDatabaseConnection.Open();
+                    System.Data.SQLite.SQLiteDataAdapter m_OreDatabasedataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from STDMinerals", m_OreDatabaseConnection);
+                    DataSet OreDatabaseds = new DataSet();
+                    m_OreDatabasedataAdapter.Fill(OreDatabaseds);
+                    OreDatabasedt = OreDatabaseds.Tables[0];
+
+                    int listnum = 1;
+                    SaveFileDialog saveFile = new SaveFileDialog();
+                    saveFile.Title = table["message23"].ToString();
+                    saveFile.Filter = table["message36"].ToString();
+                    saveFile.OverwritePrompt = true;  //是否覆盖当前文件
+                    saveFile.RestoreDirectory = true;  //还原上次目录
+                    if (saveFile.ShowDialog() == DialogResult.OK)
+                    {
+                        System.Data.SQLite.SQLiteConnection.CreateFile(saveFile.FileName);
+                        System.Data.SQLite.SQLiteConnection m_OtsDatabaseConnection = new System.Data.SQLite.SQLiteConnection("data source='" + saveFile.FileName + "'");
+                        m_OtsDatabaseConnection.Open();
+                        System.Data.SQLite.SQLiteCommand OtsDatabaseCommand = m_OtsDatabaseConnection.CreateCommand();
+                        OtsDatabaseCommand.CommandText = "CREATE TABLE ClassifySTD (STDId INTEGER,StrName TEXT, Color TEXT,KeyElementList TEXT,SubElementList TEXT,UsingImgPropertyList TEXT,UsingOtherPropertyList TEXT,Expression TEXT,Hardness TEXT,Density TEXT,Electrical_conductivity TEXT,BSE INTEGER,Formula TEXT,Element TEXT,ListNum INT,GroupId INT)";
+                        OtsDatabaseCommand.ExecuteNonQuery();
+                        OtsDatabaseCommand.CommandText = "CREATE TABLE Constants (value TEXT)";
+                        OtsDatabaseCommand.ExecuteNonQuery();
+                        OtsDatabaseCommand.CommandText = "CREATE TABLE MaxEDSRules (MaxEDSTime INT,UsingElementList TEXT, UsingImgPropertyList TEXT,UsingOtherPropertyList TEXT,Expression TEXT)";
+                        OtsDatabaseCommand.ExecuteNonQuery();
+                        OtsDatabaseCommand.CommandText = "CREATE TABLE STDGroups (id INTEGER,name TEXT, color TEXT,iorder INTEGER)";
+                        OtsDatabaseCommand.ExecuteNonQuery();
+                        OtsDatabaseCommand.CommandText = "CREATE TABLE STDMinerals (id INTEGER,SPEC BLOB)";
+                        OtsDatabaseCommand.ExecuteNonQuery();
+                        OtsDatabaseCommand.CommandText = "CREATE TABLE ZeroElementRules (ZeroElement TEXT,UsingElementList TEXT, UsingImgPropertyList TEXT,Expression TEXT)";
+                        OtsDatabaseCommand.ExecuteNonQuery();
+                        System.Data.Common.DbTransaction trans = m_OtsDatabaseConnection.BeginTransaction();
+
+                        foreach (DataRow item in OreDatabasedt.Rows)
+                        {
+                            int n = 0;
+                            string STRcolor = "#0";
+                            if(int.TryParse(item["color"].ToString(),out n))
+                            {
+                                STRcolor = "#"+n.ToString("X6");
+                            }
+                            int idaAdd10 = 0;
+                            idaAdd10 = int.Parse(item["id"].ToString()) + 10;
+                            OtsDatabaseCommand.CommandText = "insert into ClassifySTD (Density,BSE,Formula,StrName,Color,STDId,ListNum,GroupId,KeyElementList,SubElementList,UsingImgPropertyList,UsingOtherPropertyList,Expression,Hardness,Electrical_conductivity,Element) values ( '" + item["density"].ToString() + "','" + item["BSEValue"].ToString() + "','" + item["formula"].ToString() + "','" + item["name"].ToString() + "','" + STRcolor + "'," + idaAdd10.ToString() + "," + listnum.ToString() + @",0,' ',' ',' ',' ',' ',' ',' ',' ')";
+                            OtsDatabaseCommand.ExecuteNonQuery();
+                            listnum++;
+                            OtsDatabaseCommand.CommandText = "insert into STDMinerals (id,SPEC) values (@id,@SPEC)";
+                            OtsDatabaseCommand.Parameters.Add("id", DbType.Int32).Value = idaAdd10;
+                            OtsDatabaseCommand.Parameters.Add("SPEC", DbType.Binary).Value = item["SPEC"];
+                            OtsDatabaseCommand.ExecuteNonQuery();
+                        }
+
+                        trans.Commit();
+                    }
+                    else
+                    {
+                        return;
+                    }
+                }
+                catch(Exception ex)
+                {
+                    MessageBox.Show(ex.ToString());
+                }
+            }
+            else
+            {
+                return;
+            }
+        }
+
+        private void rbMatchescorrespondingelement_Click(object sender, EventArgs e)
+        {
+            DataTable OreDatabasedt = new DataTable();
+            OpenFileDialog openFileDialog = new OpenFileDialog();
+            openFileDialog.Title = "Please select the database you want to math:";
+            openFileDialog.Filter = "(*.db)|*.db";
+            openFileDialog.RestoreDirectory = true;
+            openFileDialog.FilterIndex = 1;
+            if (openFileDialog.ShowDialog() == DialogResult.OK)
+            {
+                try
+                {
+                    string OreDatabaseAddress = openFileDialog.FileName;
+                    System.Data.SQLite.SQLiteConnection m_OreDatabaseConnection = new System.Data.SQLite.SQLiteConnection("data source='" + OreDatabaseAddress + "'");
+                    m_OreDatabaseConnection.Open();
+                    System.Data.SQLite.SQLiteDataAdapter m_OreDatabasedataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from MineralElements", m_OreDatabaseConnection);
+                    DataSet OreDatabaseds = new DataSet();
+                    m_OreDatabasedataAdapter.Fill(OreDatabaseds);
+                    OreDatabasedt = OreDatabaseds.Tables[0];
+
+                    System.Data.SQLite.SQLiteConnection m_OtsDatabaseConnection = new System.Data.SQLite.SQLiteConnection("data source='" + STDDBAddress + "'");
+                    m_OtsDatabaseConnection.Open();
+                    System.Data.SQLite.SQLiteCommand OtsDatabaseCommand = m_OtsDatabaseConnection.CreateCommand();
+                    OtsDatabaseCommand.CommandText = "CREATE TABLE MineralElements (mineralID INTEGER,elementID INTEGER,elementPercentage FLOAT)";
+                    OtsDatabaseCommand.ExecuteNonQuery();
+                    System.Data.Common.DbTransaction trans = m_OtsDatabaseConnection.BeginTransaction();
+
+                    System.Data.SQLite.SQLiteDataAdapter m_OtsDatabasedataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select id from STDMinerals", m_OtsDatabaseConnection);
+                    DataSet OtsDatabaseds = new DataSet();
+                    m_OtsDatabasedataAdapter.Fill(OtsDatabaseds);
+                    var OtsDatabasedt = OtsDatabaseds.Tables[0];
+
+                    List<int> IdG = new List<int>();
+                    foreach (DataRow item in OtsDatabasedt.Rows)
+                    {
+                        IdG.Add(int.Parse(item["id"].ToString()) - 10);
+                    }
+
+
+                    int n = 0;
+                    foreach (DataRow item in OreDatabasedt.Rows)
+                    {
+                        if (!int.TryParse(item["mineralID"].ToString(), out n))
+                        { continue; }
+
+                        if (IdG.Contains(n))
+                        {
+                            OtsDatabaseCommand.CommandText = "insert into MineralElements (mineralID,elementID,elementPercentage) values (@mineralID,@elementID,@elementPercentage)";
+                            OtsDatabaseCommand.Parameters.Add("mineralID", DbType.Int32).Value = (n+10);
+                            OtsDatabaseCommand.Parameters.Add("elementID", DbType.Int32).Value = item["elementID"];
+                            OtsDatabaseCommand.Parameters.Add("elementPercentage", DbType.Double).Value = item["elementPercentage"];
+                            OtsDatabaseCommand.ExecuteNonQuery();
+                        }
+                    }
+                    trans.Commit();
+                }
+                catch (Exception ex)
+                {
+                    MessageBox.Show(ex.ToString());
+                }
+            }
+            else
+            {
+                return;
+            }
+        }
+
+        private void rbNew_Click(object sender, EventArgs e)
+        {
+            SaveFileDialog saveFile = new SaveFileDialog();
+            saveFile.Title = table["message23"].ToString();
+            saveFile.Filter = table["message36"].ToString();
+            saveFile.OverwritePrompt = true;  //是否覆盖当前文件
+            saveFile.RestoreDirectory = true;  //还原上次目录
+            if (saveFile.ShowDialog() == DialogResult.OK)
+            {
+                try
+                {
+                    System.Data.SQLite.SQLiteConnection.CreateFile(saveFile.FileName);
+                    System.Data.SQLite.SQLiteConnection m_OtsDatabaseConnection = new System.Data.SQLite.SQLiteConnection("data source='" + saveFile.FileName + "'");
+                    m_OtsDatabaseConnection.Open();
+                    System.Data.SQLite.SQLiteCommand OtsDatabaseCommand = m_OtsDatabaseConnection.CreateCommand();
+                    OtsDatabaseCommand.CommandText = "CREATE TABLE ClassifySTD (STDId INTEGER,StrName TEXT, Color TEXT,KeyElementList TEXT,SubElementList TEXT,UsingImgPropertyList TEXT,UsingOtherPropertyList TEXT,Expression TEXT,Hardness TEXT,Density TEXT,Electrical_conductivity TEXT,BSE INTEGER,Formula TEXT,Element TEXT,ListNum INT,GroupId INT)";
+                    OtsDatabaseCommand.ExecuteNonQuery();
+                    OtsDatabaseCommand.CommandText = "CREATE TABLE Constants (value TEXT)";
+                    OtsDatabaseCommand.ExecuteNonQuery();
+                    OtsDatabaseCommand.CommandText = "CREATE TABLE MaxEDSRules (MaxEDSTime INT,UsingElementList TEXT, UsingImgPropertyList TEXT,UsingOtherPropertyList TEXT,Expression TEXT)";
+                    OtsDatabaseCommand.ExecuteNonQuery();
+                    OtsDatabaseCommand.CommandText = "CREATE TABLE STDGroups (id INTEGER,name TEXT, color TEXT,iorder INTEGER)";
+                    OtsDatabaseCommand.ExecuteNonQuery();
+                    OtsDatabaseCommand.CommandText = "CREATE TABLE STDMinerals (id INTEGER,SPEC BLOB)";
+                    OtsDatabaseCommand.ExecuteNonQuery();
+                    OtsDatabaseCommand.CommandText = "CREATE TABLE ZeroElementRules (ZeroElement TEXT,UsingElementList TEXT, UsingImgPropertyList TEXT,Expression TEXT)";
+                    OtsDatabaseCommand.ExecuteNonQuery();
+                    System.Data.Common.DbTransaction trans = m_OtsDatabaseConnection.BeginTransaction();
+                    trans.Commit();
+                }
+                catch(Exception ex)
+                {
+                    MessageBox.Show(ex.ToString());
+                    return;
+                }
+
+                STDDBAddress = saveFile.FileName;
+                InitForms(STDDBAddress);
+                this.Text = this.Text.Split(' ')[0] + "   " + STDDBAddress;
+                IsModified = false;
+            }
+            else
+            {
+                return;
+            }
+        }
+    }
+}

+ 229 - 0
OTSPartA_STDEditor/Form_Main.resx

@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <data name="ribbonOrbRecentItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="ribbonOrbRecentItem1.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="ribbonOrbOptionButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="ribbonOrbOptionButton1.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="ribbonOrbMenuItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="ribbonOrbMenuItem1.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="ribbonDescriptionMenuItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="ribbonDescriptionMenuItem1.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="ribbonColorChooser1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="ribbonColorChooser1.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="ribbonOrbMenuItem2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="ribbonOrbMenuItem2.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="ribbonButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="ribbonButton1.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="ribbonButton2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="ribbonButton2.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="ribbonButton3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="ribbonButton3.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+</value>
+  </data>
+</root>