/// <summary> /// Start按钮按下,开启流盘任务 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonStart_Click(object sender, EventArgs e) { if (textBox_path.Text == string.Empty) { MessageBox.Show("请指定文件保存路径!"); return; } if (channelNumbers.Count == 0) { MessageBox.Show("请指定采集通道!"); return; } button_start.Enabled = false; button_stop.Enabled = true; stop = false; sampleRate = double.Parse(textBox_sampleRate.Text); recordLength = double.Parse(textBox_recordLength.Text); // 步骤1:根据板卡型号和编号新建流盘任务 dstask = TaskCreater.CreateDAQTask(0, (BoardType)Enum.Parse(typeof(BoardType), comboBox_boardType.Text)); // 步骤2:添加流盘通道,指定采样率和流盘时间 dstask.TerminalCfg = (AITerminalCfg)Enum.Parse(typeof(AITerminalCfg), comboBox_terminalType.Text); dstask.InputImpedance = AIInputImpedance.ImpedanceHigh; dstask.Record(channelNumbers.ToArray(), sampleRate, recordLength, double.Parse(textBox_inputLow.Text), double.Parse(textBox_inputHigh.Text)); samplesToPreview = int.Parse(textBox_previewSamples.Text); priewData = new double[samplesToPreview, channelNumbers.Count]; transposedData = new double[channelNumbers.Count, samplesToPreview]; previewSpectrumBufferTransposed = new double[channelNumbers.Count, samplesToPreview / 2]; singleChannelPriewData = new double[samplesToPreview]; singleChannelSpectrumData = new double[samplesToPreview / 2]; spectrumInterval = new double[channelNumbers.Count]; // 步骤3 : 流盘文件的本地路径 dstask.FilePath = textBox_path.Text; // 步骤4:开始流盘任务 dstask.Start(); timer1.Enabled = true; }
/// <summary> /// Start按钮按下,开启流盘任务 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void metroButtonStart_Click(object sender, EventArgs e) { if (metroTextBox_path.Text == string.Empty) { MessageBox.Show("请指定文件保存路径!"); return; } if (channelNumbers.Count == 0) { MessageBox.Show("请指定采集通道!"); return; } metroButton_start.Enabled = false; metroButton_stop.Enabled = true; stop = false; sampleRate = double.Parse(metroTextBox_samleRate.Text); recordLength = double.Parse(metroTextBox_recordLength.Text); // 步骤1:根据板卡型号和编号新建流盘任务 dstask = TaskCreater.CreateDAQTask(0, (BoardType)Enum.Parse(typeof(BoardType), metroComboBox_boardType.Text)); // 步骤2:添加流盘通道,指定采样率和流盘时间 //dstask.TerminalCfg = AITerminalCfg.RSE; dstask.TerminalCfg = AITerminalCfg.Differential; dstask.InputImpedance = AIInputImpedance.ImpedanceHigh; dstask.Record(channelNumbers.ToArray(), sampleRate, recordLength, double.Parse(metroTextBox_inputLowLimit.Text), double.Parse(metroTextBox_inputHighLimit.Text)); // 步骤3 : 流盘文件的本地路径 dstask.FilePath = metroTextBox_path.Text; // 步骤4:开始流盘任务 dstask.Start(); timer1.Enabled = true; }