Example #1
0
        private void metroButtonOpen_Click(object sender, EventArgs e)
        {
            var fileBrowser = new OpenFileDialog {
                Filter = @"(*.bin)|*.bin"
            };

            if (fileBrowser.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            streamingInfo = new StreamingInfo();
            playback.OpenFile(fileBrowser.FileName, ref streamingInfo);
            metroTextBox_totalSamples.Text = streamingInfo.SamplesPerChannel.ToString();
            channels     = streamingInfo.Channels;
            channelCount = channels.Length;
            string fmt = "采样率:{0}   流盘总时间:{1}ms    流盘文件时间长度:{2}ms";

            metroLabelStripStatus.Text = string.Format(fmt, streamingInfo.SampleRate,
                                                       TimeSpan.FromMilliseconds(streamingInfo.StreamingTime), TimeSpan.FromMilliseconds(streamingInfo.AcquisitionTime));

            playback.FrameLength = int.Parse(metroTextBox_frameLength.Text);
            playbackBuffer       = new double[channelCount, playback.FrameLength];
            measurementBuffer    = new double[playback.FrameLength];

            metroButton_stopPlay.Enabled     = true;
            metroButton_startPlay.Enabled    = true;
            metroButton_open.Enabled         = false;
            trackBar1.Enabled                = true;
            metroTextBox_frameLength.Enabled = false;

            //设置tarckBar最大值为文件长度总时间,以毫秒为单位
            trackBar1.Maximum = streamingInfo.AcquisitionTime;
            trackBar1.Value   = 0;
            metroLabel_frameTimeStamp.Text = @"00:00:00:000000";

            if (aitask == null)
            {
                aitask = new JYPXIE69848HAITask(0);
            }
            dataGridView1.Columns.Clear();
            dataGridView1.Rows.Clear();
            timer2FistRun = true;
            rowNumber     = 0;
        }
Example #2
0
        private void buttonOpen_Click(object sender, EventArgs e)
        {
            var fileBrowser = new OpenFileDialog {
                Filter = @"(*.bin)|*.bin"
            };

            if (fileBrowser.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            streamingInfo = new StreamingInfo();
            playback.OpenFile(fileBrowser.FileName, ref streamingInfo);
            textBox_totalSamples.Text = streamingInfo.SamplesPerChannel.ToString();
            channels     = streamingInfo.Channels;
            channelCount = channels.Length;
            string fmt = "采样率:{0}   流盘总时间:{1}ms    流盘文件时间长度:{2}ms";

            lable_stripStatus.Text = string.Format(fmt, streamingInfo.SampleRate,
                                                   TimeSpan.FromMilliseconds(streamingInfo.StreamingTime), TimeSpan.FromMilliseconds(streamingInfo.AcquisitionTime));

            playback.FrameLength = int.Parse(textBox_frameLength.Text);
            playbackBuffer       = new double[channelCount, playback.FrameLength];

            button_stopPlay.Enabled     = true;
            button_startPlay.Enabled    = true;
            button_open.Enabled         = false;
            trackBar1.Enabled           = true;
            textBox_frameLength.Enabled = false;

            trackBar1.Maximum         = 10000;
            trackBar1.Value           = 0;
            lable_frameTimeStamp.Text = @"00:00:00:000000";
            if (playback.FrameLength < playback.TotalLength)
            {
                readyForNext = true;
            }
            else
            {
                readyForNext = false;
                MessageBox.Show("Playback frame length is long than total sample length.");
            }
        }