private void OnTextChanged(object sender, EventArgs e)
 {
     try
     {
         if (m_objRFEGen != null && m_objRFEGen.PortConnected)
         {
             RFE6GEN_CalibrationData objRFEGenCal = m_objRFEGen.GetRFE6GENCal();
             double dFreqMHZ = Convert.ToDouble(m_sRFGenFreqCW.Text);
             if ((objRFEGenCal.GetCalSize() > 0) && (dFreqMHZ >= m_objRFEGen.MinFreqMHZ) && (dFreqMHZ <= m_objRFEGen.MaxFreqMHZ))
             {
                 int      nIndex   = m_comboRFGenPowerCW.SelectedIndex;
                 double[] arrPower = objRFEGenCal.GetEstimatedAmplitudeArray(dFreqMHZ);
                 if (arrPower != null)
                 {
                     m_comboRFGenPowerCW.Items.Clear();
                     foreach (double dVal in arrPower)
                     {
                         m_comboRFGenPowerCW.Items.Add(dVal.ToString("f1") + "dBm");
                     }
                 }
                 m_comboRFGenPowerCW.SelectedIndex = nIndex;
             }
         }
     }
     catch (Exception obEx)
     {
         ReportLog(obEx.ToString());
     }
 }
예제 #2
0
 /// <summary>
 /// This function updates available power levels per frequency into the combo box,
 /// based on the actual data received from the Signal Generator object
 /// </summary>
 public void UpdatePowerLevels()
 {
     try
     {
         if (m_objGenerator != null && m_objGenerator.PortConnected)
         {
             RFE6GEN_CalibrationData objRFEGenCal = m_objGenerator.GetRFE6GENCal();
             double dFreqMHZ = m_objGenerator.RFGenCWFrequencyMHZ;
             if ((objRFEGenCal.GetCalSize() > 0) && (dFreqMHZ >= m_objGenerator.MinFreqMHZ) && (dFreqMHZ <= m_objGenerator.MaxFreqMHZ))
             {
                 int      nIndexStart = m_comboRFGenPowerStart.SelectedIndex;
                 int      nIndexStop  = m_comboRFGenPowerStop.SelectedIndex;
                 double[] arrPower    = objRFEGenCal.GetEstimatedAmplitudeArray(dFreqMHZ);
                 if (arrPower != null)
                 {
                     m_comboRFGenPowerStart.Items.Clear();
                     m_comboRFGenPowerStop.Items.Clear();
                     foreach (double dVal in arrPower)
                     {
                         m_comboRFGenPowerStart.Items.Add(dVal.ToString("f1") + "dBm");
                         m_comboRFGenPowerStop.Items.Add(dVal.ToString("f1") + "dBm");
                     }
                 }
                 m_comboRFGenPowerStart.SelectedIndex = nIndexStart;
                 m_comboRFGenPowerStop.SelectedIndex  = nIndexStop;
             }
         }
     }
     catch (Exception obEx)
     {
         ReportLog(obEx.ToString());
     }
 }