private void btnPreview_Click(object sender, EventArgs e) { float startFreq; float endFreq; if (!float.TryParse(txtStartFreq.Text.Trim( ), out startFreq)) { MessageBox.Show("Invalidate start frequency!"); return; } if (!float.TryParse(txtEndFreq.Text.Trim( ), out endFreq)) { MessageBox.Show("Invalidate end frequency!"); return; } if (startFreq >= endFreq) { MessageBox.Show("The start frequency must be smaller than the end frequency!"); return; } //Change the unit of frequency startFreq = FrequencyFormator.ChangedUnit(startFreq, (FrequencyFormator.FrequencyUnit)cboFreqUnits.SelectedValue, FrequencyFormator.FrequencyUnit.Hz); endFreq = FrequencyFormator.ChangedUnit(endFreq, (FrequencyFormator.FrequencyUnit)cboFreqUnits.SelectedValue, FrequencyFormator.FrequencyUnit.Hz); if (rbAp.Checked) { parentForm.ResultLoadedAlarm(fft.GetAmpPhaseData(startFreq, endFreq)); } if (rbRi.Checked) { parentForm.ResultLoadedAlarm(fft.GetRealImageData(startFreq, endFreq)); } }
private void cboFreqUnits_SelectedIndexChanged(object sender, EventArgs e) { float freq = FrequencyFormator.ChangedUnit(fft.Step, FrequencyFormator.FrequencyUnit.Hz, (FrequencyFormator.FrequencyUnit)cboFreqUnits.SelectedValue); this.txtFreqStep.Text = freq.ToString( ); }