Sfoglia il codice sorgente

优化报告程序针对谱图测量的结果,显示颗粒标准库的问题

zhangjiaxin 1 mese fa
parent
commit
741b5cbcb5
1 ha cambiato i file con 71 aggiunte e 28 eliminazioni
  1. 71 28
      OTSIncAReportApp/1-UI/FormStandardLibraryInformation.cs

+ 71 - 28
OTSIncAReportApp/1-UI/FormStandardLibraryInformation.cs

@@ -11,6 +11,7 @@ using System.Drawing;
 using System.IO;
 using System.Linq;
 using System.Text;
+using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 using static OTSIncAReportApp.OTSReport_Export;
@@ -56,20 +57,33 @@ namespace OTSIncAReportApp._1_UI
             ResultFile resfile = resultFile;
             string Name = "";
             string rstSTD = resfile.GetSTDName();
+			string strSTDType = resfile.GetSTDEngineType();
+			string[] result = Regex.Split(strSTDType, ":");
+
+
+			
+		    if (result[0] == "0")
+			{
+				Name = "OTSIncASysSTD";
+				return;
+			}
+			else
+			{
+				string input1 = rstSTD;
+				string[] fruits1 = input1.Split('.');
+
+				if ("NoSTDDB" == fruits1[0] ||
+					"NoSTDDB.db" == fruits1[0])
+				{
+					Name = "OTSIncASysSTD";
+					return;
+				}
+				else
+				{
+					Name = fruits1[0];
+				}
+			}
 
-            string input1 = rstSTD;
-            string[] fruits1 = input1.Split('.');
-
-            if ("NoSTDDB" == fruits1[0] ||
-                "NoSTDDB.db" == fruits1[0])
-            {
-                Name = "OTSIncASysSTD";
-                return;
-            }
-            else
-            {
-                Name = fruits1[0];
-            }
             try
             {
                 ReadClassification();
@@ -85,24 +99,53 @@ namespace OTSIncAReportApp._1_UI
                 {
                     listView1.Items.Clear();
                     DataTable dt_stl = new DataTable();
-                    SqLiteHelper sh = new SqLiteHelper("data source='" + LibraryName[i][1] + "'");
-				     
-                    if (!sh.SearchTable("SELECT COUNT(*) FROM ClassifySTD"))
+
+                    if (result[0] == "3")
                     {
-                        return;
+						SqLiteHelper sh = new SqLiteHelper("data source='" + LibraryName[i][1] + "'");
+
+						if (!sh.SearchTable("SELECT COUNT(*) FROM STDMinerals"))
+						{
+							return;
+						}
+
+						dt_stl = sh.ExecuteQuery("select * from STDMinerals");
+						m_data = dt_stl.Copy();
+						for (int a = 0; a < dt_stl.Rows.Count; a++)
+						{
+							ListViewItem item1 = new ListViewItem(dt_stl.Rows[a]["name"].ToString());
+							item1.SubItems.Add("#"+ Convert.ToInt64(dt_stl.Rows[a]["color"]).ToString("X6"));//颜色
+
+							item1.UseItemStyleForSubItems = false; // 允许为每个 SubItem 设置不同的样式
+							item1.SubItems[1].BackColor = Color.LightBlue; // 这将不会生效,除非我们处理 OwnerDraw
+							listView1.Items.Add(item1);
+						}
+                        break ;
 					}
-
-					dt_stl = sh.ExecuteQuery("select * from ClassifySTD");
-                    m_data= dt_stl.Copy();
-                    for (int a=0;a<dt_stl.Rows.Count;a++)
+                    else
                     {
-                        ListViewItem item1 = new ListViewItem(dt_stl.Rows[a]["StrName"].ToString());
-                        item1.SubItems.Add(dt_stl.Rows[a]["Color"].ToString()); 
-                        
-                        item1.UseItemStyleForSubItems = false; // 允许为每个 SubItem 设置不同的样式
-                        item1.SubItems[1].BackColor = Color.LightBlue; // 这将不会生效,除非我们处理 OwnerDraw
-                        listView1.Items.Add(item1);
-                    }
+						SqLiteHelper sh = new SqLiteHelper("data source='" + LibraryName[i][1] + "'");
+
+						if (!sh.SearchTable("SELECT COUNT(*) FROM ClassifySTD"))
+						{
+							return;
+						}
+
+						dt_stl = sh.ExecuteQuery("select * from ClassifySTD");
+						m_data = dt_stl.Copy();
+						for (int a = 0; a < dt_stl.Rows.Count; a++)
+						{
+							ListViewItem item1 = new ListViewItem(dt_stl.Rows[a]["StrName"].ToString());
+							item1.SubItems.Add(dt_stl.Rows[a]["Color"].ToString());
+
+							item1.UseItemStyleForSubItems = false; // 允许为每个 SubItem 设置不同的样式
+							item1.SubItems[1].BackColor = Color.LightBlue; // 这将不会生效,除非我们处理 OwnerDraw
+							listView1.Items.Add(item1);
+						}
+						break;
+					}
+
+             
                 }
             }
             label1.Text = "分类名";