Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            GetProgramData pgmData = new GetProgramData();

            string pressureDataPath            = @"./pressureData.txt";
            List <List <string> > pressureData = pgmData.readPressure(pressureDataPath);

            //string currentDataPath = @"\\10.200.8.73\share\1.csv";
            string currentDataPath = @textBox3.Text;
            //MessageBox.Show(currentDataPath, "读电流前错误", MessageBoxButtons.OK, MessageBoxIcon.Error);

            string currStandardDataPath            = @"./currStandardData.txt";
            List <List <string> > currStandardData = pgmData.readPressure(currStandardDataPath);

            string currStandardDataSearchPath            = @"./currStandardDataSearch.txt";
            List <List <string> > currStandardDataSearch = pgmData.readPressure(currStandardDataSearchPath);

            List <List <float> > currentData;

            try
            {
                currentData = pgmData.readCSVgetCurrent(pressureData, @currentDataPath, currStandardData, currStandardDataSearch);
                //MessageBox.Show("读电流成功", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ee)
            {
                MessageBox.Show("读原始数据:" + ee.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string nowTime = System.DateTime.Now.ToString("_yyyy_MM_dd_HH_mm_ss_ffff");
            string p       = @"./CURRENT" + nowTime + ".txt";

            pgmData.writeCurrent(@p, currentData);
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.Title  = "请选择CSV文件";
            fileDialog.Filter = "*.txt|*.txt";
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                string fileName = fileDialog.FileName;
                //List<List<float>> pressure = readPressure(fileName);
                //string s = "";
                //foreach (var item in pressure)
                //{
                //    foreach (var item2 in item)
                //    {
                //        s += item2;
                //    }
                //    s += "\r\n";
                //}
                //textBox1.Text = s;

                List <List <float> > current = new List <List <float> >();
                List <float>         l1      = new List <float>();
                for (int i = 0; i < 23; i++)
                {
                    l1.Add(i / 3);
                }
                current.Add(l1);
                List <float> l2 = new List <float>();
                for (int i = 0; i < 31; i++)
                {
                    l2.Add(i / 3);
                }
                current.Add(l2);
                GetProgramData pgmData = new GetProgramData();
                pgmData.writeCurrent(fileName, current);
            }
        }