public void PopulateAnnotatedEnvelopes(KeyValuePair <string, DynamicDataConnection> data)
        {
            if (AnnotatedEnvelopes != null)
            {
                return;
            }

            AnnotatedEnvelopes = new List <AnnotatedEnvelope>();
            var start = PfmXplorerUtil.GetClosestScanToRtFromDynamicConnection(data, RtElutionRange.Minimum);
            var end   = PfmXplorerUtil.GetClosestScanToRtFromDynamicConnection(data, RtElutionRange.Maximum);

            for (int i = start.OneBasedScanNumber; i <= end.OneBasedScanNumber + 1; i++)
            {
                var scan = data.Value.GetOneBasedScanFromDynamicConnection(i);

                if (scan.MsnOrder != 1)
                {
                    continue;
                }

                foreach (var charge in Charges)
                {
                    var envelope = PfmXplorerUtil.GetAnnotatedEnvelope(MonoisotopicMass, scan, charge);

                    if (envelope != null)
                    {
                        AnnotatedEnvelopes.Add(envelope);
                    }
                }
            }
        }
        private void topPlotView_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (CurrentlySelectedSpectraFile.Value == null)
            {
                return;
            }

            double rt      = PfmXplorerUtil.GetXPositionFromMouseClickOnChart(sender, e);
            var    theScan = PfmXplorerUtil.GetClosestScanToRtFromDynamicConnection(CurrentlySelectedSpectraFile, rt);

            DisplayAnnotatedSpectrum(theScan.OneBasedScanNumber);

            IntegratedAreaStart = theScan.OneBasedScanNumber;
        }