private void _deviceModel_ChannelsChanged(object sender, System.EventArgs e) { if (_deviceModel.IndexChannel != null) { BeginInvoke((MethodInvoker) delegate { var signalChart1 = new DrawableSignalChart(); var signalChart2 = new DrawableSignalChart(); signalChart1.SetChannel(_deviceModel.T3O1SignalChannel); signalChart2.SetChannel(_deviceModel.T4O21SignalChannel); // _signalViewController[0].SetChannel(_deviceModel.T3O1SignalChannel); // _signalViewController[1].SetChannel(_deviceModel.T4O21SignalChannel); _startSignalButton.Enabled = true; _stopSignalButton.Enabled = true; ResistanceCheckButton.Enabled = true; _deviceModel.BatteryChannel.LengthChanged += BatteryChannel_LengthChanged; try { if (_deviceModel.BatteryChannel.TotalLength > 0) { BatteryLabel.Text = $"{_deviceModel.BatteryChannel.ReadData(_deviceModel.BatteryChannel.TotalLength - 1, 1)[0]} %"; } } catch { } var indexChart = new EegIndexChart(); _indexChartPresenter = new IndexChartPresenter(indexChart, _deviceModel.IndexViewChannel, _emotionsStartButton, _statesStopButton, this); var spectrumChartT3O1 = new SpectrumChart(); var spectrumChartT4O2 = new SpectrumChart(); _spectrumChartPresenter = new SpectrumChartPresenter(spectrumChartT3O1, _spectrumAmplitudeTrackBar, new SpectrumModel(_deviceModel.T3O1SpectrumChannel)); _spectrumChartPresenter = new SpectrumChartPresenter(spectrumChartT4O2, _spectrumAmplitudeTrackBar, new SpectrumModel(_deviceModel.T4O2SpectrumChannel)); var compositeDrawable = new CompoundDrawable(); compositeDrawable.AddDrawable(indexChart, new PointF(0f, 0f), new SizeF(0.35f, 0.94f)); compositeDrawable.AddDrawable(spectrumChartT3O1, new PointF(0.35f, 0.0f), new SizeF(0.3f, 0.47f)); compositeDrawable.AddDrawable(spectrumChartT4O2, new PointF(0.35f, 0.47f), new SizeF(0.3f, 0.47f)); compositeDrawable.AddDrawable(_statesChart, new PointF(0f, 0.94f), new SizeF(1.0f, 0.06f)); compositeDrawable.AddDrawable(signalChart1, new PointF(0.65f, 0.0f), new SizeF(0.35f, 0.47f)); compositeDrawable.AddDrawable(signalChart2, new PointF(0.65f, 0.47f), new SizeF(0.35f, 0.47f)); _drawableControl.Drawable = compositeDrawable; }); } else { BeginInvoke((MethodInvoker) delegate { _startSignalButton.Enabled = false; _stopSignalButton.Enabled = false; ResistanceCheckButton.Enabled = false; }); _drawableControl.Drawable = new EmptyDrawable(); } }
private void _deviceModel_ChannelsChanged(object sender, System.EventArgs e) { if (_deviceModel.IndexChannel != null) { BeginInvoke((MethodInvoker) delegate { _startSignalButton.Enabled = true; _stopSignalButton.Enabled = true; var indexChart = new EegIndexChart(); _indexChartPresenter = new IndexChartPresenter(indexChart, _deviceModel.IndexChannel, _emotionsStartButton, _statesStopButton, this); _indexSettingsPresenter = new IndexSettingsPresenter(_indexSettingsControl, _deviceModel.IndexChannel); _indexSettingsControl.Enabled = true; var spectrumChartT3O1 = new SpectrumChart(); var spectrumChartT4O2 = new SpectrumChart(); _spectrumChartPresenter = new SpectrumChartPresenter(spectrumChartT3O1, _spectrumAmplitudeTrackBar, new SpectrumModel(_deviceModel.T3O1SpectrumChannel)); _spectrumChartPresenter = new SpectrumChartPresenter(spectrumChartT4O2, _spectrumAmplitudeTrackBar, new SpectrumModel(_deviceModel.T4O2SpectrumChannel)); var compositeDrawable = new CompoundDrawable(); compositeDrawable.AddDrawable(indexChart, new PointF(0f, 0f), new SizeF(0.7f, 0.94f)); compositeDrawable.AddDrawable(spectrumChartT3O1, new PointF(0.7f, 0.0f), new SizeF(0.3f, 0.47f)); compositeDrawable.AddDrawable(spectrumChartT4O2, new PointF(0.7f, 0.47f), new SizeF(0.3f, 0.47f)); compositeDrawable.AddDrawable(_statesChart, new PointF(0f, 0.94f), new SizeF(1.0f, 0.06f)); _drawableControl.Drawable = compositeDrawable; }); } else { BeginInvoke((MethodInvoker) delegate { _startSignalButton.Enabled = false; _stopSignalButton.Enabled = false; }); _drawableControl.Drawable = new EmptyDrawable(); } }