private void ShowChart(FormTag tag, bool value) { if (InvokeRequired) { Action <FormTag, bool> act = new Action <FormTag, bool>(ShowChart); Invoke(act, new object[] { tag, value }); } else { switch (tag) { case FormTag.REF_WAVE: if (refvoice_wave == null || refvoice_wave.IsDisposed) { refvoice_wave = new WaveViewerForm(tag); SetDataChart(FormTag.REF_WAVE); } if (value) { if (!refvoice_wave.Visible) { refvoice_wave.Show(); } } else { if (refvoice_wave.Visible) { refvoice_wave.Hide(); } } break; case FormTag.REF_FREQ: if (refvoice_freq == null || refvoice_freq.IsDisposed) { refvoice_freq = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!refvoice_freq.Visible) { refvoice_freq.Show(); } } else { if (refvoice_freq.Visible) { refvoice_freq.Hide(); } } break; case FormTag.REF_MFCC: if (refvoice_mfcc == null || refvoice_mfcc.IsDisposed) { refvoice_mfcc = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!refvoice_mfcc.Visible) { refvoice_mfcc.Show(); } } else { if (refvoice_mfcc.Visible) { refvoice_mfcc.Hide(); } } break; case FormTag.REF_DOUBLE: if (refvoice_double == null || refvoice_double.IsDisposed) { refvoice_double = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!refvoice_double.Visible) { refvoice_double.Show(); } } else { if (refvoice_double.Visible) { refvoice_double.Hide(); } } break; case FormTag.REF_DETAL: if (refvoice_detal == null || refvoice_detal.IsDisposed) { refvoice_detal = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!refvoice_detal.Visible) { refvoice_detal.Show(); } } else { if (refvoice_detal.Visible) { refvoice_detal.Hide(); } } break; case FormTag.REF_PITCH: if (refvoice_pitch == null || refvoice_pitch.IsDisposed) { refvoice_pitch = new LineChartForm(tag); SetDataChart(tag); } if (value) { if (!refvoice_pitch.Visible) { refvoice_pitch.Show(); } } else { if (refvoice_pitch.Visible) { refvoice_pitch.Hide(); } } break; case FormTag.YOUR_WAVE: if (yourvoice_wave == null || yourvoice_wave.IsDisposed) { yourvoice_wave = new WaveViewerForm(tag); SetDataChart(tag); } if (value) { if (!yourvoice_wave.Visible) { yourvoice_wave.Show(); } } else { if (yourvoice_wave.Visible) { yourvoice_wave.Hide(); } } break; case FormTag.YOUR_FREQ: if (yourvoice_freq == null || yourvoice_freq.IsDisposed) { yourvoice_freq = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!yourvoice_freq.Visible) { yourvoice_freq.Show(); } } else { if (yourvoice_freq.Visible) { yourvoice_freq.Hide(); } } break; case FormTag.YOUR_MFCC: if (yourvoice_mfcc == null || yourvoice_mfcc.IsDisposed) { yourvoice_mfcc = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!yourvoice_mfcc.Visible) { yourvoice_mfcc.Show(); } } else { if (yourvoice_mfcc.Visible) { yourvoice_mfcc.Hide(); } } break; case FormTag.YOUR_DOUBLE: if (yourvoice_double == null || yourvoice_double.IsDisposed) { yourvoice_double = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!yourvoice_double.Visible) { yourvoice_double.Show(); } } else { if (yourvoice_double.Visible) { yourvoice_double.Hide(); } } break; case FormTag.YOUR_DETAL: if (yourvoice_detal == null || yourvoice_detal.IsDisposed) { yourvoice_detal = new MfccChartForm(tag); SetDataChart(tag); yourvoice_detal.Text = ""; } if (value) { if (!yourvoice_detal.Visible) { yourvoice_detal.Show(); } } else { if (yourvoice_detal.Visible) { yourvoice_detal.Hide(); } } break; case FormTag.YOUR_PITCH: if (yourvoice_pitch == null || yourvoice_pitch.IsDisposed) { yourvoice_pitch = new LineChartForm(tag); SetDataChart(tag); } if (value) { if (!yourvoice_pitch.Visible) { yourvoice_pitch.Show(); } } else { if (yourvoice_pitch.Visible) { yourvoice_pitch.Hide(); } } break; } } }
private void ShowChart(FormTag tag, bool value) { if (InvokeRequired) { Action <FormTag, bool> act = new Action <FormTag, bool>(ShowChart); Invoke(act, new object[] { tag, value }); } else { switch (tag) { case FormTag.REF_WAVE: if (_refVoiceWave == null || _refVoiceWave.IsDisposed) { _refVoiceWave = new WaveViewerForm(tag); SetDataChart(FormTag.REF_WAVE); } if (value) { if (!_refVoiceWave.Visible) { _refVoiceWave.Show(); } } else { if (_refVoiceWave.Visible) { _refVoiceWave.Hide(); } } break; case FormTag.REF_FREQ: if (_refVoiceFreq == null || _refVoiceFreq.IsDisposed) { _refVoiceFreq = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!_refVoiceFreq.Visible) { _refVoiceFreq.Show(); } } else { if (_refVoiceFreq.Visible) { _refVoiceFreq.Hide(); } } break; case FormTag.REF_MFCC: if (_refVoiceMfcc == null || _refVoiceMfcc.IsDisposed) { _refVoiceMfcc = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!_refVoiceMfcc.Visible) { _refVoiceMfcc.Show(); } } else { if (_refVoiceMfcc.Visible) { _refVoiceMfcc.Hide(); } } break; case FormTag.REF_DOUBLE: if (_refVoiceDouble == null || _refVoiceDouble.IsDisposed) { _refVoiceDouble = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!_refVoiceDouble.Visible) { _refVoiceDouble.Show(); } } else { if (_refVoiceDouble.Visible) { _refVoiceDouble.Hide(); } } break; case FormTag.REF_DETAL: if (_refVoiceDetal == null || _refVoiceDetal.IsDisposed) { _refVoiceDetal = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!_refVoiceDetal.Visible) { _refVoiceDetal.Show(); } } else { if (_refVoiceDetal.Visible) { _refVoiceDetal.Hide(); } } break; case FormTag.REF_PITCH: if (_refVoicePitch == null || _refVoicePitch.IsDisposed) { _refVoicePitch = new LineChartForm(tag); SetDataChart(tag); } if (value) { if (!_refVoicePitch.Visible) { _refVoicePitch.Show(); } } else { if (_refVoicePitch.Visible) { _refVoicePitch.Hide(); } } break; case FormTag.YOUR_WAVE: if (_yourVoiceWave == null || _yourVoiceWave.IsDisposed) { _yourVoiceWave = new WaveViewerForm(tag); SetDataChart(tag); } if (value) { if (!_yourVoiceWave.Visible) { _yourVoiceWave.Show(); } } else { if (_yourVoiceWave.Visible) { _yourVoiceWave.Hide(); } } break; case FormTag.YOUR_FREQ: if (_yourVoiceFreq == null || _yourVoiceFreq.IsDisposed) { _yourVoiceFreq = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!_yourVoiceFreq.Visible) { _yourVoiceFreq.Show(); } } else { if (_yourVoiceFreq.Visible) { _yourVoiceFreq.Hide(); } } break; case FormTag.YOUR_MFCC: if (_yourVoiceMfcc == null || _yourVoiceMfcc.IsDisposed) { _yourVoiceMfcc = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!_yourVoiceMfcc.Visible) { _yourVoiceMfcc.Show(); } } else { if (_yourVoiceMfcc.Visible) { _yourVoiceMfcc.Hide(); } } break; case FormTag.YOUR_DOUBLE: if (_yourVoiceDouble == null || _yourVoiceDouble.IsDisposed) { _yourVoiceDouble = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!_yourVoiceDouble.Visible) { _yourVoiceDouble.Show(); } } else { if (_yourVoiceDouble.Visible) { _yourVoiceDouble.Hide(); } } break; case FormTag.YOUR_DETAL: if (_yourVoiceDetal == null || _yourVoiceDetal.IsDisposed) { _yourVoiceDetal = new MfccChartForm(tag); SetDataChart(tag); _yourVoiceDetal.Text = string.Empty; } if (value) { if (!_yourVoiceDetal.Visible) { _yourVoiceDetal.Show(); } } else { if (_yourVoiceDetal.Visible) { _yourVoiceDetal.Hide(); } } break; case FormTag.YOUR_PITCH: if (_yourVoicePitch == null || _yourVoicePitch.IsDisposed) { _yourVoicePitch = new LineChartForm(tag); SetDataChart(tag); } if (value) { if (!_yourVoicePitch.Visible) { _yourVoicePitch.Show(); } } else { if (_yourVoicePitch.Visible) { _yourVoicePitch.Hide(); } } break; } } }