Пример #1
0
 private void MainScreen_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (this.zeoStream != null)
     {
         this.exitEvent.Set();
         Thread.Sleep(100);
         this.zeoStream.Dispose();
         this.zeoStream = null;
     }
 }
Пример #2
0
        private void StartToolStripButton_Click(object sender, EventArgs e)
        {
            if (this.zeoStream != null)
            {
                this.zeoStream.Dispose();
                this.zeoStream = null;
                this.exitEvent.Reset();

                this.eegLastPosition = 0;
                this.eegScopePanel.ScrollBarMaximum = 0;
                this.eegScopePanel.ScrollBarValue   = 0;
            }

            this.timer.Reset();
            this.timer.Start();

            this.zeoStream = new ZeoStream(this.exitEvent);
            this.zeoStream.HeadbandDocked += new EventHandler(this.ZeoStream_HeadbandDocked);

            if (ZeoSettings.Default.AlarmEnabled == true && File.Exists(ZeoSettings.Default.MP3FileName) == true)
            {
                this.soundAlarm = new SoundAlarm(ZeoSettings.Default.MP3FileName, ZeoSettings.Default.AlarmFadeIn,
                                                 ZeoSettings.Default.AlarmFadeOut, ZeoSettings.Default.AlarmDuration, ZeoSettings.Default.AlarmFromTime,
                                                 ZeoSettings.Default.AlarmToTime, ZeoSettings.Default.AlarmSnooze, ZeoSettings.Default.AlarmCue);

                // Add one more channel for Alarm sound volume
                this.freqScopePanel.NumberOfChannels = ZeoMessage.FrequencyBinsLength + 2;
                this.freqScopePanel.MaxValueDisplay[this.freqScopePanel.NumberOfChannels - 1] = SoundAlarm.MaxVolume + 2000;
                this.freqScopePanel.MinValueDisplay[this.freqScopePanel.NumberOfChannels - 1] = SoundAlarm.MinVolume - 200;

                this.stageScopePanel.MaxValueDisplay[this.stageScopePanel.NumberOfChannels - 1] = SoundAlarm.MaxVolume + 2000;
                this.stageScopePanel.MinValueDisplay[this.stageScopePanel.NumberOfChannels - 1] = SoundAlarm.MinVolume - 200;
            }
            else
            {
                this.freqScopePanel.NumberOfChannels = ZeoMessage.FrequencyBinsLength + 1;
            }

            this.zeoStream.OpenLiveStream(this.comPortToolStripComboBox.Text, this.fileNameToolStripComboBox.Text, this.soundAlarm);

            this.SetFormText(this.zeoStream.FileName);

            this.startToolStripButton.Enabled    = false;
            this.settingsToolStripButton.Enabled = false;
            this.openToolStripButton.Enabled     = false;
            this.stopToolStripButton.Enabled     = true;

            this.SaveFileNames();
        }
Пример #3
0
        private void LoadFile(string file)
        {
            this.fileName = file;

            if (this.zeoStream != null)
            {
                this.zeoStream.Dispose();
                this.zeoStream = null;
            }

            this.eegLastPosition = 0;

            this.zeoStream = new ZeoStream(this.exitEvent);
            try
            {
                this.zeoStream.OpenFileStream(file);
            }
            catch (ZeoException ex)
            {
                this.fileName  = string.Empty;
                this.zeoStream = null;
                this.eegScopePanel.ScopeData   = null;
                this.freqScopePanel.ScopeData  = null;
                this.stageScopePanel.ScopeData = null;
                MessageBox.Show(ex.Message);
                return;
            }

            if (this.zeoStream.SoundAlarmEnabled == true)
            {
                // Add one more channel for Alarm sound volume
                this.freqScopePanel.NumberOfChannels = ZeoMessage.FrequencyBinsLength + 2;
                this.freqScopePanel.MaxValueDisplay[this.freqScopePanel.NumberOfChannels - 1] = SoundAlarm.MaxVolume + 2000;
                this.freqScopePanel.MinValueDisplay[this.freqScopePanel.NumberOfChannels - 1] = SoundAlarm.MinVolume - 200;

                this.stageScopePanel.MaxValueDisplay[this.stageScopePanel.NumberOfChannels - 1] = SoundAlarm.MaxVolume + 2000;
                this.stageScopePanel.MinValueDisplay[this.stageScopePanel.NumberOfChannels - 1] = SoundAlarm.MinVolume - 200;
            }
            else
            {
                this.freqScopePanel.NumberOfChannels = ZeoMessage.FrequencyBinsLength + 1;
            }

            this.eegScopePanel.ScrollBarMaximum  = this.zeoStream.Length;
            this.freqScopePanel.ScrollBarMaximum = this.zeoStream.Length;

            this.SetFormText(Path.GetFileName(this.fileName));
        }
Пример #4
0
        private void StartToolStripButton_Click(object sender, EventArgs e)
        {
            if (this.zeoStream != null)
            {
                this.zeoStream.Dispose();
                this.zeoStream = null;
                this.exitEvent.Reset();

                this.eegLastPosition = 0;
                this.eegScopePanel.ScrollBarMaximum = 0;
                this.eegScopePanel.ScrollBarValue = 0;
            }

            this.timer.Reset();
            this.timer.Start();

            this.zeoStream = new ZeoStream(this.exitEvent);
            this.zeoStream.HeadbandDocked += new EventHandler(this.ZeoStream_HeadbandDocked);

            if (ZeoSettings.Default.AlarmEnabled == true && File.Exists(ZeoSettings.Default.MP3FileName) == true)
            {
                this.soundAlarm = new SoundAlarm(ZeoSettings.Default.MP3FileName, ZeoSettings.Default.AlarmFadeIn,
                    ZeoSettings.Default.AlarmFadeOut, ZeoSettings.Default.AlarmDuration, ZeoSettings.Default.AlarmFromTime,
                    ZeoSettings.Default.AlarmToTime, ZeoSettings.Default.AlarmSnooze, ZeoSettings.Default.AlarmCue);

                // Add one more channel for Alarm sound volume
                this.freqScopePanel.NumberOfChannels = ZeoMessage.FrequencyBinsLength + 2;
                this.freqScopePanel.MaxValueDisplay[this.freqScopePanel.NumberOfChannels - 1] = SoundAlarm.MaxVolume + 2000;
                this.freqScopePanel.MinValueDisplay[this.freqScopePanel.NumberOfChannels - 1] = SoundAlarm.MinVolume - 200;

                this.stageScopePanel.MaxValueDisplay[this.stageScopePanel.NumberOfChannels - 1] = SoundAlarm.MaxVolume + 2000;
                this.stageScopePanel.MinValueDisplay[this.stageScopePanel.NumberOfChannels - 1] = SoundAlarm.MinVolume - 200;
            }
            else
            {
                this.freqScopePanel.NumberOfChannels = ZeoMessage.FrequencyBinsLength + 1;
            }

            this.zeoStream.OpenLiveStream(this.comPortToolStripComboBox.Text, this.fileNameToolStripComboBox.Text, this.soundAlarm);

            this.SetFormText(this.zeoStream.FileName);

            this.startToolStripButton.Enabled = false;
            this.settingsToolStripButton.Enabled = false;
            this.openToolStripButton.Enabled = false;
            this.stopToolStripButton.Enabled = true;

            this.SaveFileNames();
        }
Пример #5
0
 private void MainScreen_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (this.zeoStream != null)
     {
         this.exitEvent.Set();
         Thread.Sleep(100);
         this.zeoStream.Dispose();
         this.zeoStream = null;
     }
 }
Пример #6
0
        private void LoadFile(string file)
        {
            this.fileName = file;

            if (this.zeoStream != null)
            {
                this.zeoStream.Dispose();
                this.zeoStream = null;
            }

            this.eegLastPosition = 0;

            this.zeoStream = new ZeoStream(this.exitEvent);
            try
            {
                this.zeoStream.OpenFileStream(file);
            }
            catch (ZeoException ex)
            {
                this.fileName = string.Empty;
                this.zeoStream = null;
                this.eegScopePanel.ScopeData = null;
                this.freqScopePanel.ScopeData = null;
                this.stageScopePanel.ScopeData = null;
                MessageBox.Show(ex.Message);
                return;
            }

            if (this.zeoStream.SoundAlarmEnabled == true)
            {
                // Add one more channel for Alarm sound volume
                this.freqScopePanel.NumberOfChannels = ZeoMessage.FrequencyBinsLength + 2;
                this.freqScopePanel.MaxValueDisplay[this.freqScopePanel.NumberOfChannels - 1] = SoundAlarm.MaxVolume + 2000;
                this.freqScopePanel.MinValueDisplay[this.freqScopePanel.NumberOfChannels - 1] = SoundAlarm.MinVolume - 200;

                this.stageScopePanel.MaxValueDisplay[this.stageScopePanel.NumberOfChannels - 1] = SoundAlarm.MaxVolume + 2000;
                this.stageScopePanel.MinValueDisplay[this.stageScopePanel.NumberOfChannels - 1] = SoundAlarm.MinVolume - 200;
            }
            else
            {
                this.freqScopePanel.NumberOfChannels = ZeoMessage.FrequencyBinsLength + 1;
            }

            this.eegScopePanel.ScrollBarMaximum = this.zeoStream.Length;
            this.freqScopePanel.ScrollBarMaximum = this.zeoStream.Length;

            this.SetFormText(Path.GetFileName(this.fileName));
        }