Example #1
0
        private void OnLimitLineBuildFromSignal_Click(object sender, EventArgs e)
        {
            try
            {
                bool bMin = sender.ToString().Contains("M&in");

                PointPairList listCurrentPointList = null;
                int nSelectionCounter = SelectSinglePointPairList(ref listCurrentPointList);

                if (nSelectionCounter == 0)
                {
                    MessageBox.Show("Condition not met: One active display curve on screen (Avg, Max, Min or Realtime)", "Limit Lines");
                    return;
                }
                else if (nSelectionCounter > 1)
                {
                    MessageBox.Show("Condition not met: One active display curve on screen ONLY (Avg, Max, Min or Realtime)", "Limit Lines");
                    return;
                }

                using (CreateLimitLine objDialog = new CreateLimitLine())
                {
                    if (objDialog.ShowDialog(this) == DialogResult.OK)
                    {
                        double dIncrementAmplitudeDB = Convert.ToDouble(objDialog.m_edOffsetDB.Text);

                        if (bMin)
                            m_LimitLineMin = new LimitLine(listCurrentPointList);
                        else
                            m_LimitLineMax = new LimitLine(listCurrentPointList);

                        //add requested offset to each point - NOTE: This is not the RFE measurement offset so the 
                        //function SetNewOffset is not appropriate here!
                        for (int nInd = 0; nInd < listCurrentPointList.Count; nInd++)
                        {
                            if (bMin)
                                m_LimitLineMin[nInd].Y -= dIncrementAmplitudeDB;
                            else
                                m_LimitLineMax[nInd].Y += dIncrementAmplitudeDB;
                        }

                        if (bMin)
                            m_LimitLineMin.AmplitudeUnits = GetCurrentAmplitudeEnum();
                        else
                            m_LimitLineMax.AmplitudeUnits = GetCurrentAmplitudeEnum();

                        DisplaySpectrumAnalyzerData();
                    }
                }
            }
            catch (Exception obEx) { MessageBox.Show(obEx.Message); }
        }
        private void OnLimitLineBuildFromSignal_Click(object sender, EventArgs e)
        {
            try
            {
                bool bAnalyzer = (m_MainTab.SelectedTab != m_tabRFGen);

                bool bMin = sender.ToString().Contains("M&in");

                PointPairList listCurrentPointList = null;

                int nSelectionCounter = SelectSinglePointPairList(ref listCurrentPointList);

                if (nSelectionCounter == 0)
                {
                    if (bAnalyzer)
                    {
                        MessageBox.Show("Condition not met: One active display curve on screen (Avg, Max, Min or Realtime)", "Limit Lines");
                    }
                    else
                    {
                        MessageBox.Show("Condition not met: no tracking signal available", "Limit Lines");
                    }
                    return;
                }
                else if (nSelectionCounter > 1)
                {
                    MessageBox.Show("Condition not met: One active display curve on screen ONLY (Avg, Max, Min or Realtime)", "Limit Lines");
                    return;
                }

                using (CreateLimitLine objDialog = new CreateLimitLine())
                {
                    if (objDialog.ShowDialog(this) == DialogResult.OK)
                    {
                        double dIncrementAmplitudeDB = Convert.ToDouble(objDialog.m_edOffsetDB.Text);

                        if (bAnalyzer)
                        {
                            if (bMin)
                            {
                                m_LimitLineAnalyzer_Min = new LimitLine(listCurrentPointList);
                            }
                            else
                            {
                                m_LimitLineAnalyzer_Max = new LimitLine(listCurrentPointList);
                            }

                            //add requested offset to each point - NOTE: This is not the RFE measurement offset so the
                            //function SetNewOffset is not appropriate here!
                            for (int nInd = 0; nInd < listCurrentPointList.Count; nInd++)
                            {
                                if (bMin)
                                {
                                    m_LimitLineAnalyzer_Min[nInd].Y -= dIncrementAmplitudeDB;
                                }
                                else
                                {
                                    m_LimitLineAnalyzer_Max[nInd].Y += dIncrementAmplitudeDB;
                                }
                            }

                            if (bMin)
                            {
                                m_LimitLineAnalyzer_Min.AmplitudeUnits = GetCurrentAmplitudeEnum();
                            }
                            else
                            {
                                m_LimitLineAnalyzer_Max.AmplitudeUnits = GetCurrentAmplitudeEnum();
                            }

                            DisplaySpectrumAnalyzerData();
                        }
                        else
                        {
                            if (bMin)
                            {
                                m_LimitLineGenerator_Min = new LimitLine(listCurrentPointList);
                            }
                            else
                            {
                                m_LimitLineGenerator_Max = new LimitLine(listCurrentPointList);
                            }

                            //add requested offset to each point - NOTE: This is not the RFE measurement offset so the
                            //function SetNewOffset is not appropriate here!
                            for (int nInd = 0; nInd < listCurrentPointList.Count; nInd++)
                            {
                                if (bMin)
                                {
                                    m_LimitLineGenerator_Min[nInd].Y -= dIncrementAmplitudeDB;
                                }
                                else
                                {
                                    m_LimitLineGenerator_Max[nInd].Y += dIncrementAmplitudeDB;
                                }
                            }

                            DisplayTrackingData();
                        }
                    }
                }
            }
            catch (Exception obEx) { MessageBox.Show(obEx.Message); }
        }