public void ApplyOSAMeasureAll( )
        {
            try {
                DateTime startMeas = DateTime.UtcNow;
                SetAlignMode(true);

                Spectrum_OSA.PerformSingleSweep( );

                if (EnableAllChMeasurement) // All channel's ON
                {
                    // just measure secleted channel
                    SpectrumMeasure sm = (SpectrumMeasure)htChannelMeasure["Ch" + CurrentChannel.ToString()];
                    if (sm != null)
                    {
                        Spectrum_OSA.StartWavelength  = sm.StartWavelength;
                        Spectrum_OSA.StopWavelength   = sm.StopWavelength;
                        Spectrum_OSA.CenterWavelength = sm.CenterWavelength;
                        Spectrum_OSA.SpanWavelength   = 5.2f;
                        Spectrum_OSA.PerformSingleSweep();
                        Thread.Sleep(2000);
                        GetMeasureResult("Ch" + CurrentChannel.ToString());
                        Thread.Sleep(1000);
                    }
                    // don't measure 4 of them.
                    //for (int i = 0; i < 4; i++)
                    //{
                    //    SpectrumMeasure sm = (SpectrumMeasure)htChannelMeasure["Ch" + i.ToString()];
                    //    if (sm != null)
                    //    {
                    //        Spectrum_OSA.StartWavelength = sm.StartWavelength;
                    //        Spectrum_OSA.StopWavelength = sm.StopWavelength;
                    //        Spectrum_OSA.CenterWavelength = sm.CenterWavelength;
                    //        Spectrum_OSA.SpanWavelength = 5.2f;
                    //        Spectrum_OSA.PerformSingleSweep();
                    //        Thread.Sleep(2000);
                    //        GetMeasureResult("Ch" + i.ToString());
                    //        Thread.Sleep(1000);
                    //    }

                    //}
                }
                else // just one channel ON.
                {
                    GetMeasureResult(true);

                    SetAlignMode(false);
                    Spectrum_OSA.PerformSingleSweep();

                    GetMeasureResult(false);
                }
                FireOSAResultDataChanged( );
            }
            catch (Exception ex) {
                throw new Exception("MeasureAll ex=" + ex.ToString( ));
            }
            finally {
            }
        }
        private void GetMeasureResult(string channelName)
        {
            Result_OSAWavelength = (float)Spectrum_OSA.GetPeakWavelength();
            Result_SMSR          = (float)Spectrum_OSA.GetSmsr();
            result_ModeOffset    = Spectrum_OSA.GetModeOffset();
            result_PeakAmplitude = Spectrum_OSA.GetPeakPower();

            SpectrumMeasure sm = (SpectrumMeasure)htChannelMeasure[channelName];

            if (sm != null)
            {
                sm.PeakWavelength = Result_OSAWavelength;
                sm.Smsr           = Result_SMSR;
                sm.ModeOffset     = (float)result_ModeOffset;
                sm.PeakAmplitude  = (float)result_PeakAmplitude;
            }
        }