Ejemplo n.º 1
0
        private void LoadCurveButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter           = "Curves files (*.xml)|*.xml|all files (*.*)|*.*";
            dialog.InitialDirectory = Program.CurvesPath;
            dialog.RestoreDirectory = true;


            if (dialog.ShowDialog() == DialogResult.OK)
            {
                XmlSerializer xs = new XmlSerializer(typeof(CCurve));
                using (StreamReader wr = new StreamReader(dialog.FileName))
                {
                    try
                    {
                        CCurve CurveToLoad = xs.Deserialize(wr) as CCurve;
                        CurveToLoad.ComputeCaracteristicsParams();

                        SweepModeCurvesList.Add(CurveToLoad);
                        UpdateCurveComboBoxFromCurveList();

                        SpectrumPictureBox.DrawCurveCollection(SweepModeCurvesList);
                        CurveListComboBox.SelectedIndex = SweepModeCurvesList.Count - 1;
                    }
                    catch (Exception)
                    {
                        LOGError("sorry, your curve file format is incompatible with this software version");
                    }

                    Program.CurvesPath = System.IO.Path.GetDirectoryName(dialog.FileName);
                }
            }
        }
Ejemplo n.º 2
0
        public void ProcessSweepModeDisplayAcquisition(NWTDevice.RunSweepModeParam AcquisitionParams)
        {
            CGraph Graph       = SpectrumPictureBox.GetGraphConfig();
            CCurve CurveConfig = (CCurve)CurveConfigPropertyGrid.SelectedObject;

            SpectrumPictureBox.SetActiveCurve(CurveConfig);

            CurveConfig.nSpectrumLowFrequency  = AcquisitionParams.nBaseFrequency;
            CurveConfig.nSpectrumHighFrequency = AcquisitionParams.nBaseFrequency + AcquisitionParams.nFrequencyStep * AcquisitionParams.nCount;
            CurveConfig.nFrequencyStep         = AcquisitionParams.nFrequencyStep;

            if (AcquisitionParams.ResultDatas != null)
            {
                Utility.FilterArray(AcquisitionParams.ResultDatas, (int)((FilterMode)FilterComboBox.SelectedItem));
                CurveConfig.SpectrumValues = AcquisitionParams.ResultDatas;
                CurveConfig.DetermineMinMaxLevels();
                CurveConfig.ComputeCaracteristicsParams();
                if (bLoop == false)
                {
                    LOGDraw(""); // new line
                    LOGDraw("*** ----- RESULTS----- ***");
                    LOGDraw(CurveConfig.GetCurveDescription());
                }
            }

            Graph.nLastDrawingLowFrequency  = nFrequencyDetectionStart;
            Graph.nLastDrawingHighFrequency = nFrequencyDetectionEnd;
            SpectrumPictureBox.DrawCurveCollection(SweepModeCurvesList, bLoop);
        }
Ejemplo n.º 3
0
        private void CurveConfigPropertyGrid_PropertyValueChanged(object s, System.Windows.Forms.PropertyValueChangedEventArgs e)
        {
            CCurve Curve = (CCurve)CurveConfigPropertyGrid.SelectedObject;

            Curve.ComputeCaracteristicsParams();
            SpectrumPictureBox.Redraw();
            UpdateCurveComboBoxFromCurveList();
            CurveListComboBox.SelectedItem = CurveConfigPropertyGrid.SelectedObject;
        }