Переглянути джерело

极值分析法添加单样品读取数量功能

cxs 1 рік тому
батько
коміт
64b4e7e89f

+ 7 - 7
OTSExtremum/App.config

@@ -2,22 +2,22 @@
 <configuration>
     <startup> 
         
-    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup>
+    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <publisherPolicy apply="yes"/>
       <probing privatePath="System;Common;SQLiteDll;Oxford;Bruker;FEIAutoScript;OpenCv;OpenCvSharp"/>
       <dependentAssembly>
-        <assemblyIdentity name="SQLitePCLRaw.core" publicKeyToken="1488e028ca7ab535" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-2.0.7.1395" newVersion="2.0.7.1395" />
+        <assemblyIdentity name="SQLitePCLRaw.core" publicKeyToken="1488e028ca7ab535" culture="neutral"/>
+        <bindingRedirect oldVersion="0.0.0.0-2.0.7.1395" newVersion="2.0.7.1395"/>
       </dependentAssembly>
       <dependentAssembly>
-        <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
+        <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
+        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/>
       </dependentAssembly>
       <dependentAssembly>
-        <assemblyIdentity name="SQLitePCLRaw.provider.e_sqlite3" publicKeyToken="9c301db686d0bd12" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-2.0.7.1395" newVersion="2.0.7.1395" />
+        <assemblyIdentity name="SQLitePCLRaw.provider.e_sqlite3" publicKeyToken="9c301db686d0bd12" culture="neutral"/>
+        <bindingRedirect oldVersion="0.0.0.0-2.0.7.1395" newVersion="2.0.7.1395"/>
       </dependentAssembly>
     </assemblyBinding>
   </runtime>

+ 143 - 1
OTSExtremum/Business/Classify.cs

@@ -9,6 +9,140 @@ namespace OTSExtremum.Business
 {
     public class Classify
     {
+        public enum Type
+        {
+            A = 0,
+            B = 1,
+            C = 2,
+            D = 3,
+            DS = 4
+        }
+        public static Dictionary<int, List<double>> getClassByGroup(string path)
+        {
+            Data.ParticleData particleData = new Data.ParticleData(path);
+            DataTable particles = particleData.GetParticleListAndEm();
+            List<double> A = new List<double>();
+            List<double> B = new List<double>();
+            List<double> C = new List<double>();
+            List<double> D = new List<double>();
+            List<double> DS = new List<double>();
+
+            DataTable BD = particles.Clone();
+            foreach (DataRow item in particles.Rows)
+            {
+                if (Convert.ToInt32(item["RectWidth"]) == 0)
+                {
+                    continue;
+                }
+                //获取最大长度和最小宽度
+                double h = Convert.ToDouble(item["DMAX"]);
+                double w = Convert.ToDouble(item["DMIN"]);
+                double dLengthWidthRatio = h / w;
+                if (dLengthWidthRatio < 1)
+                {
+                    dLengthWidthRatio = 1 / dLengthWidthRatio;
+                }
+                if (dLengthWidthRatio >= 3)//长宽比大于3的颗粒,根据化学元素不同,分为A类和C类
+                {
+                    //A or C class
+                    string element = item["Element"].ToString();
+                    if (element.IndexOf("S-") > -1)
+                    {
+                        A.Add(Convert.ToDouble(item["PERIMETER"]));
+                    }
+                    else if (element.IndexOf("O-") > -1) 
+                    {
+                        C.Add(Convert.ToDouble(item["PERIMETER"]));
+                    }
+                }
+                else//长宽比小于3的颗粒,有3种情况,一种是串条状的B类颗粒,一种是单独的D类颗粒,如果费雷特直径大于13则为DS类颗粒
+                {
+                    // B, or D or DS
+                    // compute Feret's diameter	
+                    double dFeretDiameter = Convert.ToDouble(item["PERIMETER"]);
+                    if (dFeretDiameter >= 13)
+                    {
+                        // DS					
+                        DS.Add(Convert.ToDouble(item["PERIMETER"]));
+                    }
+                    else
+                    {
+                        //不能确定是B或D,先设为INVALID
+                        BD.Rows.Add(item.ItemArray);
+                    }
+                }
+
+            }
+            foreach (DataRow item in BD.Rows)
+            {
+                double xs = 1142 / 1024;
+                int left = Convert.ToInt32(item["RectLeft"]);
+                int top = Convert.ToInt32(item["RectTop"]);
+                int width = Convert.ToInt32(item["RectWidth"]);
+                int height = Convert.ToInt32(item["RectHeight"]);
+
+                int cenX = left + width / 2;
+                int Bottom = top - height;
+                bool isline = false;
+                for (int i = 0; i < BD.Rows.Count; i++)
+                {
+                    int leftB = Convert.ToInt32(item["RectLeft"]);
+                    int topB = Convert.ToInt32(item["RectTop"]);
+                    int widthB = Convert.ToInt32(item["RectWidth"]);
+                    int heightB = Convert.ToInt32(item["RectHeight"]);
+
+                    int cenBX = leftB + widthB / 2;
+                    int BottomB = topB - heightB;
+
+                    double dd = 0, ds = 0;
+                    ds = Math.Abs(cenX - cenBX);
+                    if (ds * xs < 10)//认为两个颗粒在一条竖直线上,但不在一起
+                    {
+                        if (Bottom > topB)//current particle is on the above
+                        {
+                            dd = Bottom - topB;
+                            if (dd * xs < 40)//认为这两个颗粒在一个串条上
+                            {
+                                isline = true;
+                                break;
+                            }
+                        }
+                        else if (BottomB > top) //current particle is on the below
+                        {
+                            dd = BottomB - top;
+                            if (dd * xs < 40)
+                            {
+                                isline = true;
+                                break;
+                            }
+                        }
+                    }
+                }
+                if (isline)
+                {
+                    B.Add(Convert.ToDouble(item["PERIMETER"]));
+                }
+                else
+                {
+                    D.Add(Convert.ToDouble(item["PERIMETER"]));
+                }
+
+            }
+
+            SetZeroBackfill(particles.Rows.Count, ref A);
+            SetZeroBackfill(particles.Rows.Count, ref B);
+            SetZeroBackfill(particles.Rows.Count, ref C);
+            SetZeroBackfill(particles.Rows.Count, ref D);
+            SetZeroBackfill(particles.Rows.Count, ref DS);
+
+            Dictionary<int, List<double>> dic = new Dictionary<int, List<double>>();
+            dic.Add((int)Type.A, A);
+            dic.Add((int)Type.B, B);
+            dic.Add((int)Type.C, C);
+            dic.Add((int)Type.D, D);
+            dic.Add((int)Type.DS, DS);
+            return dic;
+        }
         public static double[] getClass(string path)
         {
             Data.ParticleData particleData = new Data.ParticleData(path);
@@ -135,7 +269,15 @@ namespace OTSExtremum.Business
             }
             return new double[] {A,B,C,D,DS};
         }
-        
+
+        static void SetZeroBackfill(int count,ref List<double> ll)
+        {
+            for (int i = ll.Count; i < count; i++)
+            {
+                ll.Add(0);
+            }
+            ll.Sort((x, y) => -x.CompareTo(y));
+        }
     }
     
 }

+ 143 - 0
OTSExtremum/DataReadConfigurationForm.Designer.cs

@@ -0,0 +1,143 @@
+
+namespace OTSExtremum
+{
+    partial class DataReadConfigurationForm
+    {
+        /// <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.label1 = new System.Windows.Forms.Label();
+            this.tB_filepath = new System.Windows.Forms.TextBox();
+            this.btn_open = new System.Windows.Forms.Button();
+            this.label2 = new System.Windows.Forms.Label();
+            this.tB_loadCount = new System.Windows.Forms.TextBox();
+            this.btn_load = new System.Windows.Forms.Button();
+            this.panel1 = new System.Windows.Forms.Panel();
+            this.panel1.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(3, 11);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(155, 12);
+            this.label1.TabIndex = 0;
+            this.label1.Text = "请选择测量结果所在文件夹:";
+            // 
+            // tB_filepath
+            // 
+            this.tB_filepath.Location = new System.Drawing.Point(2, 36);
+            this.tB_filepath.Name = "tB_filepath";
+            this.tB_filepath.Size = new System.Drawing.Size(508, 21);
+            this.tB_filepath.TabIndex = 1;
+            // 
+            // btn_open
+            // 
+            this.btn_open.Location = new System.Drawing.Point(516, 34);
+            this.btn_open.Name = "btn_open";
+            this.btn_open.Size = new System.Drawing.Size(49, 23);
+            this.btn_open.TabIndex = 2;
+            this.btn_open.Text = "打开";
+            this.btn_open.UseVisualStyleBackColor = true;
+            this.btn_open.Click += new System.EventHandler(this.btn_open_Click);
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(15, 105);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(137, 12);
+            this.label2.TabIndex = 3;
+            this.label2.Text = "单个测量结果加载数量:";
+            // 
+            // tB_loadCount
+            // 
+            this.tB_loadCount.Location = new System.Drawing.Point(158, 102);
+            this.tB_loadCount.Name = "tB_loadCount";
+            this.tB_loadCount.Size = new System.Drawing.Size(51, 21);
+            this.tB_loadCount.TabIndex = 4;
+            this.tB_loadCount.Text = "1";
+            this.tB_loadCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+            // 
+            // btn_load
+            // 
+            this.btn_load.Location = new System.Drawing.Point(511, 121);
+            this.btn_load.Name = "btn_load";
+            this.btn_load.Size = new System.Drawing.Size(76, 29);
+            this.btn_load.TabIndex = 5;
+            this.btn_load.Text = "确认加载";
+            this.btn_load.UseVisualStyleBackColor = true;
+            this.btn_load.Click += new System.EventHandler(this.btn_load_Click);
+            // 
+            // panel1
+            // 
+            this.panel1.Controls.Add(this.label1);
+            this.panel1.Controls.Add(this.tB_filepath);
+            this.panel1.Controls.Add(this.btn_open);
+            this.panel1.Location = new System.Drawing.Point(12, 12);
+            this.panel1.Name = "panel1";
+            this.panel1.Size = new System.Drawing.Size(575, 75);
+            this.panel1.TabIndex = 6;
+            // 
+            // DataReadConfigurationForm
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(599, 161);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.tB_loadCount);
+            this.Controls.Add(this.panel1);
+            this.Controls.Add(this.btn_load);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+            this.MaximizeBox = false;
+            this.MaximumSize = new System.Drawing.Size(615, 200);
+            this.MinimizeBox = false;
+            this.MinimumSize = new System.Drawing.Size(615, 200);
+            this.Name = "DataReadConfigurationForm";
+            this.ShowIcon = false;
+            this.ShowInTaskbar = false;
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+            this.Text = "DataLoad";
+            this.Load += new System.EventHandler(this.DataReadConfigurationForm_Load);
+            this.panel1.ResumeLayout(false);
+            this.panel1.PerformLayout();
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.TextBox tB_filepath;
+        private System.Windows.Forms.Button btn_open;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.TextBox tB_loadCount;
+        private System.Windows.Forms.Button btn_load;
+        private System.Windows.Forms.Panel panel1;
+    }
+}

+ 68 - 0
OTSExtremum/DataReadConfigurationForm.cs

@@ -0,0 +1,68 @@
+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 OTSExtremum
+{
+    public partial class DataReadConfigurationForm : Form
+    {
+        int _loadCount = 0;
+        string _filepath = "";
+        public int LoadCount
+        {
+            set { _loadCount = value; }
+            get { return _loadCount; }
+        }
+
+        public string Filepath
+        {
+            set { _filepath = value; }
+            get { return _filepath; }
+        }
+
+        public DataReadConfigurationForm()
+        {
+            InitializeComponent();
+        }
+
+        private void btn_open_Click(object sender, EventArgs e)
+        {
+            System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
+            dialog.Description = "请选择测量结果所在文件夹";
+            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                tB_filepath.Text = dialog.SelectedPath;
+            }
+        }
+
+        private void DataReadConfigurationForm_Load(object sender, EventArgs e)
+        {
+
+        }
+
+        private void btn_load_Click(object sender, EventArgs e)
+        {
+            if(tB_filepath.Text==null)
+            {
+                MessageBox.Show("请选择一个测量结果!");
+            }
+            int count = 0;
+            if(!int.TryParse(tB_loadCount.Text,out count))
+            {
+                MessageBox.Show("请填写正确数据格式!");
+                tB_loadCount.Focus();
+                return;
+            }
+            LoadCount = count;
+            Filepath = tB_filepath.Text;
+            this.DialogResult = DialogResult.OK;
+            Close();
+        }
+    }
+}

+ 120 - 0
OTSExtremum/DataReadConfigurationForm.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>

+ 11 - 8
OTSExtremum/ExtremumApp.Designer.cs

@@ -69,7 +69,7 @@
             // 
             this.ribbon1.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.ribbon1.Location = new System.Drawing.Point(0, 0);
-            this.ribbon1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.ribbon1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.ribbon1.Minimized = false;
             this.ribbon1.Name = "ribbon1";
             // 
@@ -91,7 +91,7 @@
             this.ribbon1.QuickAcessToolbar.Image = null;
             this.ribbon1.QuickAcessToolbar.Tag = null;
             this.ribbon1.QuickAcessToolbar.ToolTipImage = null;
-            this.ribbon1.Size = new System.Drawing.Size(1638, 130);
+            this.ribbon1.Size = new System.Drawing.Size(1092, 130);
             this.ribbon1.TabIndex = 0;
             this.ribbon1.Tabs.Add(this.rbtab1);
             this.ribbon1.Tabs.Add(this.rbtab2);
@@ -528,27 +528,30 @@
             // 
             // panel1
             // 
-            this.panel1.Location = new System.Drawing.Point(0, 130);
+            this.panel1.Location = new System.Drawing.Point(0, 87);
+            this.panel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.panel1.Name = "panel1";
-            this.panel1.Size = new System.Drawing.Size(1638, 235);
+            this.panel1.Size = new System.Drawing.Size(1092, 157);
             this.panel1.TabIndex = 1;
             // 
             // panel2
             // 
-            this.panel2.Location = new System.Drawing.Point(0, 380);
+            this.panel2.Location = new System.Drawing.Point(0, 253);
+            this.panel2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.panel2.Name = "panel2";
-            this.panel2.Size = new System.Drawing.Size(1638, 237);
+            this.panel2.Size = new System.Drawing.Size(1092, 158);
             this.panel2.TabIndex = 2;
             // 
             // ExtremumApp
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1638, 664);
+            this.ClientSize = new System.Drawing.Size(1092, 443);
             this.Controls.Add(this.panel2);
             this.Controls.Add(this.panel1);
             this.Controls.Add(this.ribbon1);
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+            this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.Name = "ExtremumApp";
             this.Text = "钢铁夹杂物极值分析";
             this.Load += new System.EventHandler(this.ExtremumApp_Load);

+ 29 - 21
OTSExtremum/ExtremumApp.cs

@@ -41,11 +41,12 @@ namespace OTSExtremum
         /// <param name="e"></param>
         private void btnAddFile_Click(object sender, EventArgs e)
         {
-            System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
-            dialog.Description = "请选择测量结果所在文件夹";
+            DataReadConfigurationForm dialog = new DataReadConfigurationForm();
             if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
-                ScanFile(dialog.SelectedPath,panel1);
+                this.Cursor = Cursors.WaitCursor;
+                ScanFile(dialog.Filepath, dialog.LoadCount,panel1);
+                this.Cursor = Cursors.Default;
             }
         }
         /// <summary>
@@ -285,13 +286,13 @@ namespace OTSExtremum
                 return;
             }
             Panel panel = (Panel)gp.Controls[0];
-            System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
-            dialog.Description = "请选择测量结果所在文件夹";
+            DataReadConfigurationForm dialog = new DataReadConfigurationForm();
             if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
-                ScanFile(dialog.SelectedPath, panel);
+                this.Cursor = Cursors.WaitCursor;
+                ScanFile(dialog.Filepath, dialog.LoadCount, panel);
+                this.Cursor = Cursors.Default;
             }
-
         }
         /// <summary>
         /// 删除颗粒
@@ -506,7 +507,7 @@ namespace OTSExtremum
         /// </summary>
         /// <param name="path">文件夹路径</param>
         /// <param name="panel">添加数据的容器</param>
-        private void ScanFile(string path, Panel panel)
+        private void ScanFile(string path,int loadCount,Panel panel)
         {
             //扫描路径
             DirectoryInfo info = new DirectoryInfo(path);
@@ -522,19 +523,26 @@ namespace OTSExtremum
                     //string fpath = System.IO.Path.GetDirectoryName(file.Name);
                     try
                     {
-                        double[] list = Business.Classify.getClass(file.DirectoryName);
+                        var dic = Business.Classify.getClassByGroup(file.DirectoryName);
                         int sel = typeIndex;
-                        CheckBox checkBox = new CheckBox();
-                        checkBox.Text = Math.Round(list[sel], 2).ToString();
-                        checkBox.Tag = list;
-                        checkBox.Width = 80;
-                        // checkBox.Font = new Font(checkBox.Font.FontFamily, 8, checkBox.Font.Style);
-                        int chkcount = panel.Controls.Count;
-                        int row = chkcount / 10;
-                        int col = chkcount % 10;
-
-                        checkBox.Location = new Point(10 + col * 80, row * 35);
-                        panel.Controls.Add(checkBox);
+                        for (int j = 0; j < loadCount; j++)
+                        {
+                            if(j>=dic[sel].Count)
+                            {
+                                break;
+                            }
+                            CheckBox checkBox = new CheckBox();
+                            checkBox.Text = Math.Round(dic[sel][j], 2).ToString();
+                            checkBox.Tag = new double[] {dic[0][j], dic[1][j], dic[2][j], dic[3][j], dic[4][j]};
+                            checkBox.Width = 80;
+                            // checkBox.Font = new Font(checkBox.Font.FontFamily, 8, checkBox.Font.Style);
+                            int chkcount = panel.Controls.Count;
+                            int row = chkcount / 10;
+                            int col = chkcount % 10;
+
+                            checkBox.Location = new Point(10 + col * 80, row * 35);
+                            panel.Controls.Add(checkBox);
+                        }
                     }
                     catch (Exception e)
                     {
@@ -543,7 +551,7 @@ namespace OTSExtremum
                   
 
                 }
-                else ScanFile(files[i].FullName, panel);
+                else ScanFile(files[i].FullName, loadCount, panel);
             }
 
         }

+ 12 - 12
OTSExtremum/ExtremumApp.resx

@@ -134,12 +134,6 @@
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAW
         JQAAFiUBSVIk8AAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
-</value>
-  </data>
-  <data name="rbbtntype.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
-    <value>
-        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAW
-        JQAAFiUBSVIk8AAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="gbflA.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@@ -200,6 +194,12 @@
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAW
         JQAAFiUBSVIk8AAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="rbbtntype.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAW
+        JQAAFiUBSVIk8AAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="rbbtn4.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@@ -242,12 +242,6 @@
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAW
         JQAAFiUBSVIk8AAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
-</value>
-  </data>
-  <data name="fztype.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
-    <value>
-        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAW
-        JQAAFiUBSVIk8AAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonButton15.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@@ -308,6 +302,12 @@
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAW
         JQAAFiUBSVIk8AAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="fztype.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAW
+        JQAAFiUBSVIk8AAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonButton12.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

+ 11 - 2
OTSExtremum/OTSExtremum.csproj

@@ -8,7 +8,7 @@
     <OutputType>WinExe</OutputType>
     <RootNamespace>OTSExtremum</RootNamespace>
     <AssemblyName>OTSExtremum</AssemblyName>
-    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
     <Deterministic>true</Deterministic>
@@ -61,7 +61,7 @@
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
     <DebugSymbols>true</DebugSymbols>
-    <OutputPath>bin\x64\Debug\</OutputPath>
+    <OutputPath>..\Bin\x64\Debug\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DebugType>full</DebugType>
     <PlatformTarget>x64</PlatformTarget>
@@ -225,6 +225,12 @@
     <Compile Include="ChartSherp.Designer.cs">
       <DependentUpon>ChartSherp.cs</DependentUpon>
     </Compile>
+    <Compile Include="DataReadConfigurationForm.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="DataReadConfigurationForm.Designer.cs">
+      <DependentUpon>DataReadConfigurationForm.cs</DependentUpon>
+    </Compile>
     <Compile Include="Data\ParticleData.cs" />
     <Compile Include="Data\SqlHelper.cs" />
     <Compile Include="ExtremumApp.cs">
@@ -283,6 +289,9 @@
     <EmbeddedResource Include="ChartSherp.resx">
       <DependentUpon>ChartSherp.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="DataReadConfigurationForm.resx">
+      <DependentUpon>DataReadConfigurationForm.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="ExtremumApp.resx">
       <DependentUpon>ExtremumApp.cs</DependentUpon>
     </EmbeddedResource>

+ 9 - 3
OTSExtremum/Program.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 using System.Windows.Forms;
 
 namespace OTSExtremum
@@ -11,6 +8,15 @@ namespace OTSExtremum
         /// <summary>
         /// 应用程序的主入口点。
         /// </summary>
+        static Program()
+        {
+            string privatepath = "System;Common;DevExpress;FEIAutoScript;SQLiteDll;OxfordExtender;OTSCPPDll;OpenCvSharp;CefSharp";
+            AppDomain.CurrentDomain.SetData("PRIVATE_BINPATH", privatepath);
+            AppDomain.CurrentDomain.SetData("BINPATH_PROBE_ONLY", privatepath);
+            var m = typeof(AppDomainSetup).GetMethod("UpdateContextProperty", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
+            var funsion = typeof(AppDomain).GetMethod("GetFusionContext", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
+            m.Invoke(null, new object[] { funsion.Invoke(AppDomain.CurrentDomain, null), "PRIVATE_BINPATH", privatepath });
+        }
         [STAThread]
         static void Main()
         {

+ 31 - 31
OTSExtremum/Properties/Resources.Designer.cs

@@ -1,10 +1,10 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
-//     This code was generated by a tool.
-//     Runtime Version:4.0.30319.42000
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
 //
-//     Changes to this file may cause incorrect behavior and will be lost if
-//     the code is regenerated.
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
 // </auto-generated>
 //------------------------------------------------------------------------------
 
@@ -13,12 +13,12 @@ namespace OTSExtremum.Properties {
     
     
     /// <summary>
-    ///   A strongly-typed resource class, for looking up localized strings, etc.
+    ///   一个强类型的资源类,用于查找本地化的字符串等。
     /// </summary>
-    // This class was auto-generated by the StronglyTypedResourceBuilder
-    // class via a tool like ResGen or Visual Studio.
-    // To add or remove a member, edit your .ResX file then rerun ResGen
-    // with the /str option, or rebuild your VS project.
+    // 此类是由 StronglyTypedResourceBuilder
+    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+    // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+    // (以 /str 作为命令选项),或重新生成 VS 项目。
     [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
@@ -33,7 +33,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Returns the cached ResourceManager instance used by this class.
+        ///   返回此类使用的缓存的 ResourceManager 实例。
         /// </summary>
         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
         internal static global::System.Resources.ResourceManager ResourceManager {
@@ -47,8 +47,8 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Overrides the current thread's CurrentUICulture property for all
-        ///   resource lookups using this strongly typed resource class.
+        ///   重写当前线程的 CurrentUICulture 属性,对
+        ///   使用此强类型资源类的所有资源查找执行重写。
         /// </summary>
         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
         internal static global::System.Globalization.CultureInfo Culture {
@@ -61,7 +61,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap A {
             get {
@@ -71,7 +71,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap A_15_243636363636px_1146855_easyicon_net {
             get {
@@ -81,7 +81,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap A_30_487272727273px_1146855_easyicon_net {
             get {
@@ -91,7 +91,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap A1 {
             get {
@@ -101,7 +101,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap add_32px_520097_easyicon_net {
             get {
@@ -111,7 +111,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap add_32px_520097_easyicon1 {
             get {
@@ -121,7 +121,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap B {
             get {
@@ -131,7 +131,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap b_12_334545454545px_1146869_easyicon_net {
             get {
@@ -141,7 +141,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap C1 {
             get {
@@ -151,7 +151,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap D {
             get {
@@ -161,7 +161,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap DS {
             get {
@@ -171,7 +171,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap open_Size_32 {
             get {
@@ -181,7 +181,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap page_zoom_32px_572021_easyicon_net__1_ {
             get {
@@ -191,7 +191,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap start_here_32px_572110_easyicon_net {
             get {
@@ -201,7 +201,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap stop_32px_520119_easyicon_net {
             get {
@@ -211,7 +211,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap vcs_add_32px_572229_easyicon_net {
             get {
@@ -221,7 +221,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap vcs_remove_32px_572232_easyicon_net {
             get {
@@ -231,7 +231,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap 删除32 {
             get {
@@ -241,7 +241,7 @@ namespace OTSExtremum.Properties {
         }
         
         /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
         internal static System.Drawing.Bitmap 添加32 {
             get {

+ 4 - 4
OTSExtremum/Properties/Settings.Designer.cs

@@ -1,10 +1,10 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
-//     This code was generated by a tool.
-//     Runtime Version:4.0.30319.42000
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
 //
-//     Changes to this file may cause incorrect behavior and will be lost if
-//     the code is regenerated.
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
 // </auto-generated>
 //------------------------------------------------------------------------------