private void btnOpenData_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "所有Dasp测试文件|*.sts"; indata = new List <float>(); string Fname = null; float gain = 1f; openFileDialog.Title = "选择输入文件"; if (DialogResult.OK == openFileDialog.ShowDialog()) { Fname = openFileDialog.FileName; try { long dataLength = 0; //this.txtFilename.Text = Fname; string fn = Fname.Replace(".sts", ".tsp"); string[] paras = DaspSDK.Read(fn); if ((paras != null) && (paras.Length == 9)) { gain = Convert.ToSingle(paras[5]); this.CalCv.Text = Convert.ToString(DaspSDK.ChangeDataToD(paras[7])); // this.CalCv.Text = paras[7]; fWaveSfIn = Convert.ToSingle(paras[0]); this.WaveSf.Text = paras[0]; } using (FileStream fs = new FileStream(openFileDialog.FileName, FileMode.Open, FileAccess.Read)) { dataLength = fs.Length; BinaryReader r = new BinaryReader(fs); for (int i = 0; i < dataLength / 4; i++) { indata.Add(r.ReadSingle());// / gain / cv); } nWavePtNum = Convert.ToInt32(dataLength / 4); this.WavePtNum.Text = Convert.ToString(nWavePtNum); } } catch { } } //if (0 < dasptool.DaspAmplyStaticInMemoryFloat(indata.ToArray(), nWavePtNum, out fMean, out fMax, out fMin, out fVariance, out fRV, out fMS, out fRMS)) //{ // //this.fMax.Text = Convert.ToString(fMax); // //this.fMean.Text = Convert.ToString(fMean); // //this.fMax.Text = Convert.ToString(fMax); // //this.fMin.Text = Convert.ToString(fMin); // //this.fVariance.Text = Convert.ToString(fVariance); // //this.fRV.Text = Convert.ToString(fRV); // //this.fMS.Text = Convert.ToString(fMS); // //this.fRMS.Text = Convert.ToString(fRMS); //} }
private void btncmp_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "所有Dasp测试文件|*.sts"; indata = new List <float>(); string Fname = null; float gain = 1f; openFileDialog.Title = "选择输入文件"; if (DialogResult.OK == openFileDialog.ShowDialog()) { Fname = openFileDialog.FileName; try { long dataLength = 0; //this.txtFilename.Text = Fname; string fn = Fname.Replace(".sts", ".tsp"); string[] paras = DaspSDK.Read(fn); if ((paras != null) && (paras.Length == 9)) { gain = Convert.ToSingle(paras[5]); this.CalCv.Text = Convert.ToString(DaspSDK.ChangeDataToD(paras[7])); this.CalCv.Text = paras[7]; fWaveSfIn = Convert.ToSingle(paras[0]); this.WaveSf.Text = paras[0]; } using (FileStream fs = new FileStream(openFileDialog.FileName, FileMode.Open, FileAccess.Read)) { dataLength = fs.Length; BinaryReader r = new BinaryReader(fs); for (int i = 0; i < dataLength / 4; i++) { indata.Add(r.ReadSingle());// / gain / cv); } nWavePtNum = Convert.ToInt32(dataLength / 4); this.WavePtNum.Text = Convert.ToString(nWavePtNum); } SetSecondlstdata(); } catch { } } }
private void btnOpenData_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "所有Dasp测试文件|*.sts"; indata = new List <float>(); string Fname = null; float gain = 1f; openFileDialog.Title = "选择输入文件"; if (DialogResult.OK == openFileDialog.ShowDialog()) { Fname = openFileDialog.FileName; try { long dataLength = 0; //this.txtFilename.Text = Fname; string fn = Fname.Replace(".sts", ".tsp"); string[] paras = DaspSDK.Read(fn); if ((paras != null) && (paras.Length == 9)) { gain = Convert.ToSingle(paras[5]); this.fCalCv = DaspSDK.ChangeDataToD(paras[7]); } using (FileStream fs = new FileStream(openFileDialog.FileName, FileMode.Open, FileAccess.Read)) { dataLength = fs.Length; BinaryReader r = new BinaryReader(fs); for (int i = 0; i < dataLength / 4; i++) { indata.Add(r.ReadSingle() * gain / fCalCv); } nWavePtNum = Convert.ToInt32(dataLength / 4); } if (indata != null) { switch (this.pointsperpage.SelectedIndex) { case 0: this.mcadLine1.SetDrawPara(0, 128); break; case 1: this.mcadLine1.SetDrawPara(0, 256); break; case 2: this.mcadLine1.SetDrawPara(0, 512); break; case 3: this.mcadLine1.SetDrawPara(0, 1024); break; case 4: this.mcadLine1.SetDrawPara(0, 2048); break; case 5: this.mcadLine1.SetDrawPara(0, 4096); break; case 6: this.mcadLine1.SetDrawPara(0, 8192); break; default: //this.mcadLine1.PageNumberOfValue = -1; break; } IList <IList <float>[]> datalsts = new List <IList <float>[]>(); IList <float>[] waveData = new IList <float> [1]; //波形图只有一组绘制数据 waveData[0] = indata; // new List<float>(); //初始化第一组数据 this.mcadLine1.DrawParts = 2; this.mcadLine1.BmSpan = 30; datalsts.Add(waveData); this.mcadLine1.drawall = true; this.mcadLine1.SetDrawDataAll(datalsts); this.mcadLine1.Focus(); } } catch { } } }