Selaa lähdekoodia

报告添加导入数据库功能

cxs 3 vuotta sitten
vanhempi
commit
f5f0b2549a
20 muutettua tiedostoa jossa 612 lisäystä ja 49 poistoa
  1. 8 0
      Bin/x64/Debug/Resources/XMLData/ResourceForSTDManage-EN.xml
  2. 8 1
      Bin/x64/Debug/Resources/XMLData/ResourceForSTDManage-ZH.xml
  3. 0 1
      OTSCPP/OTSClassifyEngine/InclutionEngine/OTSClassifyEng.cpp
  4. 71 3
      OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs
  5. 13 2
      OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.designer.cs
  6. 46 0
      OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionSortImage.cs
  7. 13 2
      OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionSortImage.designer.cs
  8. 1 1
      OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionSortImage.resx
  9. 19 5
      OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_XRayTable.cs
  10. 14 2
      OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.Designer.cs
  11. 88 24
      OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.cs
  12. 2 2
      OTSIncAReportApp/3-ServiceCenter/DataOperation/DataAccess/ParticleData.cs
  13. 59 2
      OTSPartA_STDEditor/Form_ConstantsEditor2.cs
  14. 80 0
      OTSPartA_STDEditor/ImportStandardLibraryTypeSelection.Designer.cs
  15. 39 0
      OTSPartA_STDEditor/ImportStandardLibraryTypeSelection.cs
  16. 120 0
      OTSPartA_STDEditor/ImportStandardLibraryTypeSelection.resx
  17. 9 0
      OTSPartA_STDEditor/OTSPartA_STDEditor.csproj
  18. 11 3
      OTSPartA_STDEditor/Program.cs
  19. 10 1
      OTSPartA_STDEditor/STDEditor.cs
  20. 1 0
      OTSPartA_STDEditor/STDRuleslist.cs

+ 8 - 0
Bin/x64/Debug/Resources/XMLData/ResourceForSTDManage-EN.xml

@@ -381,4 +381,12 @@
 	  <Control name="message32" text="Tip"/>
     </Controls>
   </Form>
+  <Form>
+    <Name>ImportStandardLibraryTypeSelection</Name>
+    <Controls>
+	  <Control name="ImportStandardLibraryTypeSelection" text="Please select an import type"/>
+      <Control name="bn_xray" text="X-ray spectrum peak map"/>
+      <Control name="bn_expression" text="Expression"/>
+    </Controls>
+  </Form>
 </Resource>

+ 8 - 1
Bin/x64/Debug/Resources/XMLData/ResourceForSTDManage-ZH.xml

@@ -377,7 +377,14 @@
 	  <Control name="message30" text="所对应值输入错误!"/>
 	  <Control name="message31" text="常数库更新成功!"/>
 	  <Control name="message32" text="提示"/>
-	  
+    </Controls>
+  </Form>
+  <Form>
+    <Name>ImportStandardLibraryTypeSelection</Name>
+    <Controls>
+	  <Control name="ImportStandardLibraryTypeSelection" text="请选择导入类型"/>
+      <Control name="bn_xray" text="X-ray谱峰图"/>
+      <Control name="bn_expression" text="表达式"/>
     </Controls>
   </Form>
 </Resource>

+ 0 - 1
OTSCPP/OTSClassifyEngine/InclutionEngine/OTSClassifyEng.cpp

@@ -232,7 +232,6 @@ namespace OTSClassifyEngine
 			double dMolarFe_O = Cal100NorValue(dOMolar + dFeMolar, a_dMolarSum + dCarbonMolar);
 			if (dMolarFe_O > FEO_MOLAR_CUTOFF)
 			{
-
 				if (a_listElementChemistries.size() == 2)//there is only Fe and O
 				{
 					if (std::find_if(a_listElementChemistries.begin(), a_listElementChemistries.end(), [](CElementChemistryPtr i) {return ((i->GetName().CompareNoCase(STR_CR) != 0) && (i->GetName().CompareNoCase(STR_O) != 0)); }) != a_listElementChemistries.end())

+ 71 - 3
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -56,7 +56,8 @@ namespace OTSIncAReportGraph.Controls
        CopyImage=2,
        OriginalSplicing= 3,
        DeleteParticle=4,       
-	   ParticleSegmentation=5
+	   ParticleSegmentation=5,
+       ImportSTDDb=6
     }
     /// <summary>
     /// 选择导出的图片是原图还是颗粒渲染后的图片
@@ -1326,8 +1327,17 @@ namespace OTSIncAReportGraph.Controls
                         CMenuStrip.Items[(int)RightButtonMenu.MoveSEMToParticle].Visible = true;
                         CMenuStrip.Items[(int)RightButtonMenu.MoveSEMToParticle].Tag = item;
 
-                        CMenuStrip.Items[(int)RightButtonMenu.ParticleSegmentation].Visible = true;
                         DisplayParticle dp = (DisplayParticle)item;
+                        //if (dp.TypeId == 9)
+                        //{
+                            CMenuStrip.Items[(int)RightButtonMenu.ImportSTDDb].Visible = true;
+                        //}
+                        //else
+                        //{
+                        //    CMenuStrip.Items[(int)RightButtonMenu.ImportSTDDb].Visible = false;
+                        //}
+
+                        CMenuStrip.Items[(int)RightButtonMenu.ParticleSegmentation].Visible = true;
                         m_ParticleSegmentation.ParticleData = dp.objParticleData;
                     }
                     if (((DisplayParticle)item).IsSelect)
@@ -1357,7 +1367,7 @@ namespace OTSIncAReportGraph.Controls
                     CMenuStrip.Items[(int)RightButtonMenu.OriginalSplicing].Visible = true;
                     CMenuStrip.Items[(int)RightButtonMenu.MoveSEMToParticle].Visible = false;
                     CMenuStrip.Items[(int)RightButtonMenu.ParticleSegmentation].Visible = false;
-
+                    CMenuStrip.Items[(int)RightButtonMenu.ImportSTDDb].Visible = false;
                 }
                       
 
@@ -1470,6 +1480,8 @@ namespace OTSIncAReportGraph.Controls
             string str_IncAName = "";
             str_IncAName = m_mouseOver_dparticle.TypeName;
 
+            Particle particle = resultFile.List_OTSField.Find(x => x.FieldID == m_mouseOver_dparticle.FieldId).ParticleList.Find(x => x.ParticleId == m_mouseOver_dparticle.ParticleId);
+            control_XRayTable1.SetParticleInfo("Area:"+ Math.Round(particle.Area,2)+" "+"DELONG:"+ Math.Round(particle.DELONG,2)+" "+"DFERET:"+ Math.Round(particle.DFERET,2)+" "+"DINSCR:"+ Math.Round(particle.DINSCR,2)+" "+"DMAX:"+ Math.Round(particle.DMAX,2)+"\n"+"DMEAN:"+ Math.Round(particle.DMEAN,2)+" "+"DMIN:"+ Math.Round(particle.DMIN,2)+" "+"DPERP:"+ Math.Round(particle.DPERP,2)+" "+"ORIENTATION:"+ Math.Round(particle.ORIENTATION,2)+" "+"PERIMETER:"+ Math.Round(particle.PERIMETER,2));
 
             //获取数据后,需要对xraytable设置
             control_XRayTable1.Visible = false;
@@ -2291,5 +2303,61 @@ namespace OTSIncAReportGraph.Controls
         {
             Particle_Segmentation();
         }
+
+        private void ImportSTDDb_Click(object sender, EventArgs e)
+        {
+            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)resultFile.ResultInfo["Sample"])["Members"]);
+            string STDName = ((Dictionary<string, object>)sampleMembers["MsrParams"])["STDName"].ToString();
+            string ResultDbPath = resultFile.FilePath + "\\FIELD_FILES\\Inclusion.db";
+            if (STDName.ToLower().Split('.')[0] == "nostddb")
+            {
+                OpenFileDialog openFileDialog = new OpenFileDialog();
+                openFileDialog.Filter = "(*.db)|*.db";
+                openFileDialog.RestoreDirectory = true;
+                openFileDialog.FilterIndex = 1;
+                openFileDialog.Title = "Please choose a STD to add the rule!";
+                if (openFileDialog.ShowDialog() == DialogResult.OK)
+                {
+                    try
+                    {
+                        string arguments = openFileDialog.FileName;
+                        foreach (BaseObject item in m_list_allDPart)
+                        {
+                            DisplayParticle dp = (DisplayParticle)item;
+
+                            if (ReportFun.WhetherInRange(dp, m_mouse_now_point))
+                            {
+                                arguments += " " + ResultDbPath + " " + dp.FieldId + " " + dp.ParticleId + " " + dp.XRayId;
+                                break;
+                            }
+                        }
+
+                        System.Diagnostics.Process p = System.Diagnostics.Process.Start(".\\OTSPartA_STDEditor.exe", arguments);
+                        p.WaitForExit();
+                    }
+                    catch (Exception ex)
+                    {
+                        log.Error("OTSPartA_STDEditor:" + ex.ToString());
+                    }
+                }
+            }
+            else
+            {
+                string arguments = ".\\Config\\SysData\\"+ STDName.Split('.')[0]+".db";
+                foreach (BaseObject item in m_list_allDPart)
+                {
+                    DisplayParticle dp = (DisplayParticle)item;
+
+                    if (ReportFun.WhetherInRange(dp, m_mouse_now_point))
+                    {
+                        arguments += " " + ResultDbPath + " " + dp.FieldId + " " + dp.ParticleId + " " + dp.XRayId;
+                        break;
+                    }
+                }
+
+                System.Diagnostics.Process p = System.Diagnostics.Process.Start(".\\OTSPartA_STDEditor.exe", arguments);
+                p.WaitForExit();
+            }
+        }
     }
 }

+ 13 - 2
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.designer.cs

@@ -36,6 +36,7 @@
             this.ExportoriginalspliceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.ToolStripMenuItemDelete_Particle = new System.Windows.Forms.ToolStripMenuItem();
             this.分割颗粒ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.ImportSTDDb = new System.Windows.Forms.ToolStripMenuItem();
             this.CMenuStrip.SuspendLayout();
             this.SuspendLayout();
             // 
@@ -48,9 +49,10 @@
             this.toolStripMenuItem_copyimage,
             this.ExportoriginalspliceToolStripMenuItem,
             this.ToolStripMenuItemDelete_Particle,
-            this.分割颗粒ToolStripMenuItem});
+            this.分割颗粒ToolStripMenuItem,
+            this.ImportSTDDb});
             this.CMenuStrip.Name = "contextMenuStrip1";
-            this.CMenuStrip.Size = new System.Drawing.Size(219, 206);
+            this.CMenuStrip.Size = new System.Drawing.Size(219, 236);
             // 
             // ToolStripMenuItem_selected
             // 
@@ -98,6 +100,14 @@
             this.分割颗粒ToolStripMenuItem.Text = "分割颗粒";
             this.分割颗粒ToolStripMenuItem.Click += new System.EventHandler(this.分割颗粒ToolStripMenuItem_Click);
             // 
+            // ImportSTDDb
+            // 
+            this.ImportSTDDb.Image = global::OTSIncAReportApp.Properties.Resources.复制1;
+            this.ImportSTDDb.Name = "ImportSTDDb";
+            this.ImportSTDDb.Size = new System.Drawing.Size(218, 30);
+            this.ImportSTDDb.Text = "导入标准库";
+            this.ImportSTDDb.Click += new System.EventHandler(this.ImportSTDDb_Click);
+            // 
             // Control_DrawDistrbutionImageAndBSE
             // 
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -122,5 +132,6 @@
         private System.Windows.Forms.ToolStripMenuItem ExportoriginalspliceToolStripMenuItem;
         private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItemDelete_Particle;
         private System.Windows.Forms.ToolStripMenuItem 分割颗粒ToolStripMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem ImportSTDDb;
     }
 }

+ 46 - 0
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionSortImage.cs

@@ -661,6 +661,9 @@ namespace OTSIncAReportGraph.Controls
 
             CMenuStrip.Items[4].Tag = "";
             CMenuStrip.Items[4].Enabled = false;
+
+            CMenuStrip.Items[7].Tag = "";
+            CMenuStrip.Items[7].Enabled = false;
             if (e.Button == MouseButtons.Right)
             {
                 //这个判断右键菜单加在这里,也不知道对不对
@@ -696,6 +699,10 @@ namespace OTSIncAReportGraph.Controls
                                 else
                                     CMenuStrip.Items[4].Enabled = false;
 
+                                //if (dp.TypeId == 9)
+                                //{
+                                    CMenuStrip.Items[7].Enabled = true;
+                                //}
 
                                 m_sem_mouse_now_point = new Point(dp.SEMPosX, dp.SEMPosY);
                                 m_str_mouseshow_left = "颗粒SEM位置:" + dp.SEMPosX.ToString() + ":" + dp.SEMPosY.ToString();
@@ -1000,6 +1007,8 @@ namespace OTSIncAReportGraph.Controls
             string str_IncALibName = "";
             str_IncALibName = m_mouseOver_dparticle.TypeName;
 
+            Particle particle = resultFile.List_OTSField.Find(x => x.FieldID == m_mouseOver_dparticle.FieldId).ParticleList.Find(x => x.ParticleId == m_mouseOver_dparticle.ParticleId);
+            control_XRayTable1.SetParticleInfo("Area:" + Math.Round(particle.Area, 2) + " " + "DELONG:" + Math.Round(particle.DELONG, 2) + " " + "DFERET:" + Math.Round(particle.DFERET, 2) + " " + "DINSCR:" + Math.Round(particle.DINSCR, 2) + " " + "DMAX:" + Math.Round(particle.DMAX, 2) + "\n" + "DMEAN:" + Math.Round(particle.DMEAN, 2) + " " + "DMIN:" + Math.Round(particle.DMIN, 2) + " " + "DPERP:" + Math.Round(particle.DPERP, 2) + " " + "ORIENTATION:" + Math.Round(particle.ORIENTATION, 2) + " " + "PERIMETER:" + Math.Round(particle.PERIMETER, 2));
 
             //获取数据后,需要对xraytable设置
             control_XRayTable1.Visible = false;
@@ -1535,5 +1544,42 @@ namespace OTSIncAReportGraph.Controls
 
         #endregion
 
+        private void ImportSTDDb_Click(object sender, EventArgs e)
+        {
+            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)resultFile.ResultInfo["Sample"])["Members"]);
+            string STDName = ((Dictionary<string, object>)sampleMembers["MsrParams"])["STDName"].ToString();
+            string ResultDbPath = resultFile.FilePath + "\\FIELD_FILES\\Inclusion.db";
+            if (STDName.ToLower().Split('.')[0] == "nostddb")
+            {
+                OpenFileDialog openFileDialog = new OpenFileDialog();
+                openFileDialog.Filter = "(*.db)|*.db";
+                openFileDialog.RestoreDirectory = true;
+                openFileDialog.FilterIndex = 1;
+                openFileDialog.Title = "Please choose a STD to add the rule!";
+                if (openFileDialog.ShowDialog() == DialogResult.OK)
+                {
+                    try
+                    {
+                        string arguments = openFileDialog.FileName;
+                        DisplayParticle dp = (DisplayParticle)CMenuStrip.Items[0].Tag;
+                        arguments += " " + ResultDbPath + " " + dp.FieldId + " " + dp.ParticleId + " " + dp.XRayId;
+                        System.Diagnostics.Process p = System.Diagnostics.Process.Start(".\\OTSPartA_STDEditor.exe", arguments);
+                        p.WaitForExit();
+                    }
+                    catch (Exception ex)
+                    {
+                        MessageBox.Show("OTSPartA_STDEditor:" + ex.ToString());
+                    }
+                }
+            }
+            else
+            {
+                string arguments = ".\\Config\\SysData\\" + STDName.Split('.')[0] + ".db";
+                DisplayParticle dp = (DisplayParticle)CMenuStrip.Items[0].Tag; 
+                arguments += " " + ResultDbPath + " " + dp.FieldId + " " + dp.ParticleId + " " + dp.XRayId;
+                System.Diagnostics.Process p = System.Diagnostics.Process.Start(".\\OTSPartA_STDEditor.exe", arguments);
+                p.WaitForExit();
+            }
+        }
     }
 }

+ 13 - 2
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionSortImage.designer.cs

@@ -37,6 +37,7 @@
             this.ToolStripMenuItem_movesempoint = new System.Windows.Forms.ToolStripMenuItem();
             this.ToolStripMenuItem_copyimage = new System.Windows.Forms.ToolStripMenuItem();
             this.ToolStripMenuItemShowSmallParticle = new System.Windows.Forms.ToolStripMenuItem();
+            this.ImportSTDDb = new System.Windows.Forms.ToolStripMenuItem();
             this.CMenuStrip.SuspendLayout();
             this.SuspendLayout();
             // 
@@ -50,9 +51,10 @@
             this.另存选择颗粒ToolStripMenuItem,
             this.ToolStripMenuItem_movesempoint,
             this.ToolStripMenuItem_copyimage,
-            this.ToolStripMenuItemShowSmallParticle});
+            this.ToolStripMenuItemShowSmallParticle,
+            this.ImportSTDDb});
             this.CMenuStrip.Name = "contextMenuStrip1";
-            this.CMenuStrip.Size = new System.Drawing.Size(219, 214);
+            this.CMenuStrip.Size = new System.Drawing.Size(219, 244);
             // 
             // ToolStripMenuItem_id
             // 
@@ -109,6 +111,14 @@
             this.ToolStripMenuItemShowSmallParticle.Visible = false;
             this.ToolStripMenuItemShowSmallParticle.Click += new System.EventHandler(this.ToolStripMenuItemShowSmallParticle_Click);
             // 
+            // ImportSTDDb
+            // 
+            this.ImportSTDDb.Image = global::OTSIncAReportApp.Properties.Resources.复制1;
+            this.ImportSTDDb.Name = "ImportSTDDb";
+            this.ImportSTDDb.Size = new System.Drawing.Size(218, 30);
+            this.ImportSTDDb.Text = "导入标准库";
+            this.ImportSTDDb.Click += new System.EventHandler(this.ImportSTDDb_Click);
+            // 
             // Control_DrawDistrbutionSortImage
             // 
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -135,5 +145,6 @@
         private Control_Ruler control_Ruler1;
         private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_copyimage;
         private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItemShowSmallParticle;
+        private System.Windows.Forms.ToolStripMenuItem ImportSTDDb;
     }
 }

+ 1 - 1
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionSortImage.resx

@@ -118,6 +118,6 @@
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   <metadata name="CMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>17, 17</value>
+    <value>12, 22</value>
   </metadata>
 </root>

+ 19 - 5
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_XRayTable.cs

@@ -80,6 +80,8 @@ namespace OTSIncAReportGraph.Controls
 
         float m_f_kmlfzpd_max = 30;                                     //KML峰值上界限,进行记数的值,峰值判断的界限,需要按峰值最高值,和
         float m_f_kmlfzpd_mix = 5;                                      //KML峰值下界限
+
+        string m_ParticleInfo = "";                                    //颗粒相关信息
         #endregion
 
         #region 属性相关
@@ -146,6 +148,15 @@ namespace OTSIncAReportGraph.Controls
             get { return m_b_show_analysisxray; }
             set { m_b_show_analysisxray = value; }
         }
+
+        /// <summary>
+        /// 显示颗粒相关信息
+        /// </summary>
+        public string ParticleInfo
+        {
+            get { return m_ParticleInfo; }
+            set { m_ParticleInfo = value; }
+        }
         #endregion
 
         #region 构造函数
@@ -164,6 +175,11 @@ namespace OTSIncAReportGraph.Controls
             return in_value / m_xraytopixel_multiple;
         }
 
+        public void SetParticleInfo(string a_ParticleInfo)
+        {
+            m_ParticleInfo = a_ParticleInfo;
+        }
+
         /// <summary>
         /// 设置搜索xray和分析xray值到,记录变量中,及转换成显示变量中,用来供XrayTable显示及计算使用
         /// </summary>
@@ -630,14 +646,12 @@ namespace OTSIncAReportGraph.Controls
                 StringBuilder sb = new StringBuilder();
                 for (int i = 0; i < m_list_showelementinfo.Count; i++)
                 {
-                   
-
                     sb.Append(m_list_showelementinfo[i].ElementName);
                     sb.Append("(");
-                    sb.Append(m_list_showelementinfo[i].Percentage.ToString("0.00/"));
-                    sb.Append(m_list_showelementinfo[i].percentageIn100.ToString("0.00) "));
-                    
+                    sb.Append(m_list_showelementinfo[i].Percentage.ToString("0.00)"));
                 }
+                sb.Append("\n");
+                sb.Append(m_ParticleInfo);
                 string str_element = sb.ToString();
                 SizeF out_testsizef = g.MeasureString(str_element, m_thisfont);
 

+ 14 - 2
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.Designer.cs

@@ -71,6 +71,7 @@
             this.testToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.EXCELToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.ToolStripMenuItemDelete_Particle = new System.Windows.Forms.ToolStripMenuItem();
+            this.ImportSTDDb = new System.Windows.Forms.ToolStripMenuItem();
             this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
             this.dgV_ParticlesDevidePage = new System.Windows.Forms.DataGridView();
             this.panel2.SuspendLayout();
@@ -399,9 +400,10 @@
             this.ToolStripMenuItem_exportimagefile,
             this.testToolStripMenuItem,
             this.EXCELToolStripMenuItem,
-            this.ToolStripMenuItemDelete_Particle});
+            this.ToolStripMenuItemDelete_Particle,
+            this.ImportSTDDb});
             this.contextMenuStrip1.Name = "contextMenuStrip1";
-            this.contextMenuStrip1.Size = new System.Drawing.Size(219, 310);
+            this.contextMenuStrip1.Size = new System.Drawing.Size(219, 340);
             // 
             // ToolStripMenuItem1
             // 
@@ -487,6 +489,14 @@
             this.ToolStripMenuItemDelete_Particle.Text = "Delete particles";
             this.ToolStripMenuItemDelete_Particle.Click += new System.EventHandler(this.ToolStripMenuItem_Delete_Particle_Click);
             // 
+            // ImportSTDDb
+            // 
+            this.ImportSTDDb.Image = global::OTSIncAReportApp.Properties.Resources.复制32;
+            this.ImportSTDDb.Name = "ImportSTDDb";
+            this.ImportSTDDb.Size = new System.Drawing.Size(218, 30);
+            this.ImportSTDDb.Text = "导入标准库";
+            this.ImportSTDDb.Click += new System.EventHandler(this.ImportSTDDb_Click);
+            // 
             // tableLayoutPanel1
             // 
             this.tableLayoutPanel1.ColumnCount = 1;
@@ -520,6 +530,7 @@
             this.dgV_ParticlesDevidePage.RowTemplate.Height = 23;
             this.dgV_ParticlesDevidePage.Size = new System.Drawing.Size(1502, 741);
             this.dgV_ParticlesDevidePage.TabIndex = 5;
+            this.dgV_ParticlesDevidePage.MouseDown += new System.Windows.Forms.MouseEventHandler(this.dgV_ParticlesDevidePage_MouseDown);
             // 
             // ParticlesGridDevidePage
             // 
@@ -585,5 +596,6 @@
         private System.Windows.Forms.DataGridView dgV_ParticlesDevidePage;
         private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItemDelete_Particle;
         private System.Windows.Forms.Button btn_ReMeasure;
+        private System.Windows.Forms.ToolStripMenuItem ImportSTDDb;
     }
 }

+ 88 - 24
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.cs

@@ -89,7 +89,7 @@ namespace OTSIncAReportGrids
 
         frmReportConditionChoose m_condition;
         FieldData fieldData;
-		DataTable particlesAll;
+        DataTable particlesAll;
         DataTable particles;
         ParticleData Particledata;
         UserLibraryData userLibrary;
@@ -185,7 +185,8 @@ namespace OTSIncAReportGrids
             if (sou.Contains("+"))
             {
                 result = m_ReportApp.m_rstDataMgr.ResultFilesList[0];
-            } else
+            }
+            else
             {
                 for (int i = 0; i < m_ReportApp.m_rstDataMgr.ResultFilesList.Count; i++)
                 {
@@ -230,16 +231,16 @@ namespace OTSIncAReportGrids
                 }
                 else
                 {
-                string str_libraryName = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)result.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString();
-                userLibrary = new UserLibraryData(str_libraryName);
+                    string str_libraryName = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)result.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString();
+                    userLibrary = new UserLibraryData(str_libraryName);
                     if (userLibrary.GetSqlHelper() != null)
-                {
-                    userLibraryData = userLibrary.GetSubAttributeFromDatabase();
-                }
-                else
-                {
-                    userLibraryData = null;
-                }
+                    {
+                        userLibraryData = userLibrary.GetSubAttributeFromDatabase();
+                    }
+                    else
+                    {
+                        userLibraryData = null;
+                    }
                 }
                 //初始化底层操作类
                 m_OTSIncAReportGridsFun = new OTSReportGridsFun(m_ReportApp, this);
@@ -276,7 +277,7 @@ namespace OTSIncAReportGrids
         }
 
         #region 自定义方法
-       
+
         bool UpdateTable()
         {
             int sel = m_ReportApp.m_conditionChoose.m_SourceGridData.GetComboDownListIndexByItemName(OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE_TYPE);
@@ -319,7 +320,7 @@ namespace OTSIncAReportGrids
                 for (int i = 0; i < selectParticles.Count; i++)
                 {
                     dtUelect.Rows.Add(selectParticles[i].FieldId, selectParticles[i].ParticleId, selectParticles[i].AveGray, selectParticles[i].RectLeft, selectParticles[i].RectTop, selectParticles[i].RectWidth, selectParticles[i].RectHeight, selectParticles[i].Area, selectParticles[i].PosX, selectParticles[i].PosX, selectParticles[i].TypeId, /*selectParticles[i].ElementNum,*/ selectParticles[i].SegmentNum, selectParticles[i].SEMPosX, selectParticles[i].SEMPosY, selectParticles[i].ParticleId, selectParticles[i].DMAX, selectParticles[i].DMIN, selectParticles[i].DPERP, selectParticles[i].PERIMETER, selectParticles[i].ORIENTATION, selectParticles[i].DINSCR, selectParticles[i].DMEAN, selectParticles[i].DELONG, selectParticles[i].DFERET, selectParticles[i].TypeName, selectParticles[i].TypeColor, "", "", "", "", "");
-                 }
+                }
                 if (userLibraryData != null)
                 {
                     for (int i = 0; i < dtUelect.Rows.Count; i++)
@@ -845,7 +846,7 @@ namespace OTSIncAReportGrids
 
                                 Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(particles.Rows[i]["RectLeft"]), Y = Convert.ToInt32(particles.Rows[i]["RectTop"]), Width = Convert.ToInt32(particles.Rows[i]["RectWidth"]), Height = Convert.ToInt32(particles.Rows[i]["RectHeight"]) };
                                 Bitmap bmap = Particledata.GetBitmapByParticle(FieldImage.Value, rectangle);
-                                bmap.Tag = new List<string>() { particles.Rows[i]["FieldId"].ToString(), particles.Rows[i]["ParticleId"].ToString(), particles.Rows[i]["TypeId"].ToString() };
+                                bmap.Tag = new List<string>() { particles.Rows[i]["FieldId"].ToString(), particles.Rows[i]["ParticleId"].ToString(), particles.Rows[i]["TypeId"].ToString(), particles.Rows[i]["XrayId"].ToString() };
                                 dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Value = bmap;
                                 dgV_ParticlesDevidePage.Rows[add_rowindex].Height = bmap.Height + 20;
                             }
@@ -905,7 +906,7 @@ namespace OTSIncAReportGrids
                         {
                             string str = ChangeHardnessColor(particles.Rows[i]["Hardness"].ToString());
                             {
-                                if(str== "#FF0000")
+                                if (str == "#FF0000")
                                 {
                                     dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Style.ForeColor = Color.Red;
                                 }
@@ -1833,7 +1834,7 @@ namespace OTSIncAReportGrids
                 fs.Close();
 
                 sheet = workbook.CreateSheet("Particles");//创建工作表
-                
+
 
                 //创建表格边框样式风格
                 ICellStyle cellStyle = workbook.CreateCellStyle();
@@ -1933,8 +1934,8 @@ namespace OTSIncAReportGrids
 
                 for (int i_cell = 1; i_cell < 2001; i_cell++)
                 {
-                   cell = row.CreateCell(i_cell);
-                   cell.CellStyle = cellStyle;
+                    cell = row.CreateCell(i_cell);
+                    cell.CellStyle = cellStyle;
                     if (i_cell == 1)
                     {
                         cell.SetCellValue("PeakSpectrumData");
@@ -2022,14 +2023,14 @@ namespace OTSIncAReportGrids
         void CreateChart(IDrawing drawing, ISheet sheet, IClientAnchor anchor, int rowid)
         {
             var chart = drawing.CreateChart(anchor) as XSSFChart;
-            
+
             //图表
             var data = chart.ChartDataFactory.CreateLineChartData<double, double>(); //折线图
 
             IChartAxis bottomAxis = chart.ChartAxisFactory.CreateCategoryAxis(AxisPosition.Bottom);
-            
+
             IValueAxis leftAxis = chart.ChartAxisFactory.CreateValueAxis(AxisPosition.Left);
-            leftAxis.Crosses=AxisCrosses.AutoZero;
+            leftAxis.Crosses = AxisCrosses.AutoZero;
             leftAxis.IsVisible = true;
             bottomAxis.IsVisible = true;
             //数据源
@@ -2041,7 +2042,7 @@ namespace OTSIncAReportGrids
                 doubles[i] = i;
             }
             IChartDataSource<double> xs = DataSources.FromArray(doubles);
-            
+
             //数据系列
             var s1 = data.AddSeries(xs, ys);
 
@@ -2376,10 +2377,73 @@ namespace OTSIncAReportGrids
             GC.Collect();
             GC.WaitForPendingFinalizers();
         }
-    }
-
 
+        private void ImportSTDDb_Click(object sender, EventArgs e)
+        {
+            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)resultFile.ResultInfo["Sample"])["Members"]);
+            string STDName = ((Dictionary<string, object>)sampleMembers["MsrParams"])["STDName"].ToString();
+            string ResultDbPath = resultFile.FilePath + "\\FIELD_FILES\\Inclusion.db";
+            if (STDName.ToLower().Split('.')[0] == "nostddb")
+            {
+                OpenFileDialog openFileDialog = new OpenFileDialog();
+                openFileDialog.Filter = "(*.db)|*.db";
+                openFileDialog.RestoreDirectory = true;
+                openFileDialog.FilterIndex = 1;
+                openFileDialog.Title = "Please choose a STD to add the rule!";
+                if (openFileDialog.ShowDialog() == DialogResult.OK)
+                {
+                    try
+                    {
+                        string arguments = openFileDialog.FileName;
+                        var SelectRows= dgV_ParticlesDevidePage.SelectedRows;
+                        DataGridViewRow dgvr = SelectRows[0];
+                        Bitmap ls_bp = (Bitmap)dgvr.Cells[2].Value;
+                        List<string> list_str = (List<string>)ls_bp.Tag;
+                        arguments += " " + ResultDbPath + " " + list_str[0].ToString() + " " + list_str[1].ToString() + " " + list_str[3].ToString();
+                        System.Diagnostics.Process p = System.Diagnostics.Process.Start(".\\OTSPartA_STDEditor.exe", arguments);
+                        p.WaitForExit();
+                    }
+                    catch (Exception ex)
+                    {
+                        log.Error("OTSPartA_STDEditor:" + ex.ToString());
+                    }
+                }
+            }
+            else
+            {
+                string arguments = ".\\Config\\SysData\\" + STDName.Split('.')[0] + ".db";
+                var selectRow = dgV_ParticlesDevidePage.SelectedRows[0];
+                Bitmap ls_bp = (Bitmap)selectRow.Cells[2].Value;
+                List<string> list_str = (List<string>)ls_bp.Tag;
+                arguments += " " + ResultDbPath + " " + list_str[0].ToString() + " " + list_str[1].ToString() + " " + list_str[3].ToString();
+                System.Diagnostics.Process p = System.Diagnostics.Process.Start(".\\OTSPartA_STDEditor.exe", arguments);
+                p.WaitForExit();
+            }
+        }
 
+        private void dgV_ParticlesDevidePage_MouseDown(object sender, MouseEventArgs e)
+        {
 
+            var SelectRows = dgV_ParticlesDevidePage.SelectedRows;
+            if (SelectRows != null && SelectRows.Count == 1)
+            {
+                DataGridViewRow dgvr = SelectRows[0];
+                Bitmap ls_bp = (Bitmap)dgvr.Cells[2].Value;
+                List<string> list_str = (List<string>)ls_bp.Tag;
+                //if (list_str[2].ToString() == "9")
+                //{
+                    contextMenuStrip1.Items[11].Visible = true;
+                //}
+                //else
+                //{
+                //    contextMenuStrip1.Items[11].Visible = false;
+                //}
+            }
+            else
+            {
+                contextMenuStrip1.Items[11].Visible = false;
+            }
+        }
+    }
 }
 

+ 2 - 2
OTSIncAReportApp/3-ServiceCenter/DataOperation/DataAccess/ParticleData.cs

@@ -381,9 +381,9 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
 
             return particle;
         }
-        public Particle GetParticleXrayDataByFidAndPid(string fieldid, string particleid)
+        public Particle GetParticleXrayDataByFidAndPid(string fieldid, string xrayid)
         {
-            string sqlp = @"select xraydata from xraydata where xrayindex="+particleid+" and fieldid="
+            string sqlp = @"select xraydata from xraydata where xrayindex="+xrayid+" and fieldid="
             + fieldid ;
 
             DataTable DT = dbHelper.ExecuteDataTable(sqlp, null);

+ 59 - 2
OTSPartA_STDEditor/Form_ConstantsEditor2.cs

@@ -26,6 +26,10 @@ namespace OTSPartA_STDEditor
         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;
@@ -43,6 +47,19 @@ namespace OTSPartA_STDEditor
             m_DockWindow = new OTSDockWindow(this);
         }
 
+        public Form_ConstantsEditor2(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);
@@ -52,7 +69,47 @@ namespace OTSPartA_STDEditor
                 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);
+                    }
+                }
+            }21
         }
 
         void LoadConstants(string STDDBAddress)
@@ -1250,7 +1307,7 @@ namespace OTSPartA_STDEditor
                     this.Text = this.Text.Split(' ')[0] + "   " + STDDBAddress;
                     IsModified = false;
                 }
-                catch (Exception ex)
+                catch
                 {
                     MessageBox.Show(table["message6"].ToString(), table["message32"].ToString());
                 }

+ 80 - 0
OTSPartA_STDEditor/ImportStandardLibraryTypeSelection.Designer.cs

@@ -0,0 +1,80 @@
+
+namespace OTSPartA_STDEditor
+{
+    partial class ImportStandardLibraryTypeSelection
+    {
+        /// <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()
+        {
+            this.bn_xray = new System.Windows.Forms.Button();
+            this.bn_expression = new System.Windows.Forms.Button();
+            this.SuspendLayout();
+            // 
+            // bn_xray
+            // 
+            this.bn_xray.Location = new System.Drawing.Point(41, 39);
+            this.bn_xray.Name = "bn_xray";
+            this.bn_xray.Size = new System.Drawing.Size(252, 60);
+            this.bn_xray.TabIndex = 0;
+            this.bn_xray.Text = "X-ray谱峰图";
+            this.bn_xray.UseVisualStyleBackColor = true;
+            this.bn_xray.Click += new System.EventHandler(this.bn_xray_Click);
+            // 
+            // bn_expression
+            // 
+            this.bn_expression.Location = new System.Drawing.Point(41, 136);
+            this.bn_expression.Name = "bn_expression";
+            this.bn_expression.Size = new System.Drawing.Size(252, 60);
+            this.bn_expression.TabIndex = 1;
+            this.bn_expression.Text = "表达式";
+            this.bn_expression.UseVisualStyleBackColor = true;
+            this.bn_expression.Click += new System.EventHandler(this.bn_expression_Click);
+            // 
+            // ImportStandardLibraryTypeSelection
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(329, 236);
+            this.Controls.Add(this.bn_expression);
+            this.Controls.Add(this.bn_xray);
+            this.MaximizeBox = false;
+            this.MaximumSize = new System.Drawing.Size(345, 275);
+            this.MinimizeBox = false;
+            this.MinimumSize = new System.Drawing.Size(345, 275);
+            this.Name = "ImportStandardLibraryTypeSelection";
+            this.ShowIcon = false;
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+            this.Text = "请选择导入类型";
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Button bn_xray;
+        private System.Windows.Forms.Button bn_expression;
+    }
+}

+ 39 - 0
OTSPartA_STDEditor/ImportStandardLibraryTypeSelection.cs

@@ -0,0 +1,39 @@
+using System;
+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;
+
+namespace OTSPartA_STDEditor
+{
+    public partial class ImportStandardLibraryTypeSelection : Form
+    {
+        string m_selectevent = "";
+        public string SelectEvent
+        {
+            set { m_selectevent = value; }
+            get { return m_selectevent; }
+        }
+
+        public ImportStandardLibraryTypeSelection()
+        {
+            InitializeComponent();
+        }
+
+        private void bn_xray_Click(object sender, EventArgs e)
+        {
+            m_selectevent = "xray";
+            this.Close();
+        }
+
+        private void bn_expression_Click(object sender, EventArgs e)
+        {
+            m_selectevent = "expression";
+            this.Close();
+        }
+    }
+}

+ 120 - 0
OTSPartA_STDEditor/ImportStandardLibraryTypeSelection.resx

@@ -0,0 +1,120 @@
+<?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>
+</root>

+ 9 - 0
OTSPartA_STDEditor/OTSPartA_STDEditor.csproj

@@ -172,6 +172,12 @@
     <Compile Include="Form_PeriodicTable.Designer.cs">
       <DependentUpon>Form_PeriodicTable.cs</DependentUpon>
     </Compile>
+    <Compile Include="ImportStandardLibraryTypeSelection.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="ImportStandardLibraryTypeSelection.Designer.cs">
+      <DependentUpon>ImportStandardLibraryTypeSelection.cs</DependentUpon>
+    </Compile>
     <Compile Include="STDGroups.cs" />
     <Compile Include="Properties\Resources.Designer.cs">
       <AutoGen>True</AutoGen>
@@ -261,6 +267,9 @@
     <EmbeddedResource Include="Form_PeriodicTable.resx">
       <DependentUpon>Form_PeriodicTable.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="ImportStandardLibraryTypeSelection.resx">
+      <DependentUpon>ImportStandardLibraryTypeSelection.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="ReferenceLibrary.resx">
       <DependentUpon>ReferenceLibrary.cs</DependentUpon>
     </EmbeddedResource>

+ 11 - 3
OTSPartA_STDEditor/Program.cs

@@ -15,15 +15,23 @@ namespace OTSPartA_STDEditor
         [STAThread]
         static void Main(string[] args)
         {
+            //MessageBox.Show("a");
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
             //Application.Run(new Form_ConstantsEditor2());
-            Form_ConstantsEditor2 form_ConstantsEditor2 = new Form_ConstantsEditor2();
-            if (args.Length> 0)
+            Form_ConstantsEditor2 form_ConstantsEditor2; 
+            if (args.Length > 1)
+            {
+                form_ConstantsEditor2 = new Form_ConstantsEditor2(args);
+            }
+            else
+            {
+                form_ConstantsEditor2 = new Form_ConstantsEditor2();
+            }
+            if (args.Length > 0)
             {
                 form_ConstantsEditor2.STDDBAddress = args[0];
             }
-            //form_ConstantsEditor2.STDDBAddress = "C:\\Users\\someo\\Desktop\\OTSCleanlinesSTD.db";
             Application.Run(form_ConstantsEditor2);
         }
     }

+ 10 - 1
OTSPartA_STDEditor/STDEditor.cs

@@ -1089,7 +1089,7 @@ namespace OTSPartA_STDEditor
         protected bool AddSTDXray(int STDId, byte[] xrayData)
         {
             bool addResult = false;
-            if (m_STDXrayList != null)
+            if (m_STDXrayList != null)  
             {
                 //if (m_STDXrayList.Count > 0)
                 //{
@@ -1513,5 +1513,14 @@ namespace OTSPartA_STDEditor
             dataGridView_KeyElements.ClearSelection();
             dataGridView_SubElements.ClearSelection();
         }
+
+        public void ShowTabXray()
+        {
+            tabSTDStandrad.SelectedIndex = 1;
+        }
+        public void ShowSTD()
+        {
+            tabSTDStandrad.SelectedIndex = 0;
+        }
     }
 }

+ 1 - 0
OTSPartA_STDEditor/STDRuleslist.cs

@@ -231,6 +231,7 @@ namespace OTSPartA_STDEditor
 
             Grid_Minerals[Grid_Minerals.Rows.Count - 1, 1] = new SourceGrid.Cells.Cell();
             //Grid_Minerals[Grid_Minerals.Rows.Count - 1, 1].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
+            m_MainForm.STDDictionary[STDId].StrName = RuleName;
             m_MainForm.ChangeSTDEditorAndGrid_Attributes(STDId);
 
             SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();