public ZedGraphO18Experimental_ScanPPM(ZedGraphControl zgcGraph, Graphics g)
        {
            MasterPane myMaster = ZedGraphicExtension.InitMasterPanel(zgcGraph, g, 2, "Experimental Envelopes");

            updates.Updates.Add(new ZedGraphO18ExperimentalScan(zgcGraph, myMaster.PaneList[0], ""));

            updates.Updates.Add(new ZedGraphO18ExperimentalPPM(zgcGraph, myMaster.PaneList[1], ""));
        }
        private void lbPeptides_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lbPeptides.SelectedItem != null)
            {
                DigestPeptideInfo dpi = lbPeptides.SelectedItem as DigestPeptideInfo;

                lbPrecursor.BeginUpdate();
                try
                {
                    lbPrecursor.Items.Clear();
                    List <SimplePeakChro> peaks = (List <SimplePeakChro>)dpi.Annotations[CHRO_KEY];

                    var validPeaks = (from p in peaks
                                      where p.Peaks.Count > 0
                                      select p).ToList();

                    try
                    {
                        if (validPeaks.Count == 0)
                        {
                            ZedGraphicExtension.InitMasterPanel(zgcScans, CreateGraphics(), 1, "Chromotograph");
                            zgcScans.MasterPane.PaneList[0].ClearData();
                            return;
                        }

                        var mainPane = ZedGraphicExtension.InitMasterPanel(zgcScans, CreateGraphics(), validPeaks.Count, "Chromotograph");
                        int index    = 0;
                        foreach (var chro in peaks)
                        {
                            lbPrecursor.Items.Add(chro);
                            if (chro.Peaks.Count > 0)
                            {
                                var pplSample = new PointPairList();
                                foreach (ScanPeak p in chro.Peaks)
                                {
                                    pplSample.Add(p.Scan, p.Intensity);
                                }

                                mainPane.PaneList[index].AddCurve(MyConvert.Format("{0:0.0000},{1}", chro.Mz, chro.Charge), pplSample, Color.Red, SymbolType.None);
                                //mainPane.PaneList[index].XAxis.Scale.Min = 0;
                                //mainPane.PaneList[index].XAxis.Scale.Max = chro.MaxRetentionTime;

                                index++;
                            }
                        }
                    }
                    finally
                    {
                        ZedGraphicExtension.UpdateGraph(zgcScans);
                    }
                }
                finally
                {
                    lbPrecursor.EndUpdate();
                }

                lbIdentified.Items.Clear();
                if (ir != null)
                {
                    if (pepMap.ContainsKey(dpi.PeptideSeq))
                    {
                        lbIdentified.BeginUpdate();
                        try
                        {
                            var ids = pepMap[dpi.PeptideSeq];
                            foreach (var id in ids)
                            {
                                lbIdentified.Items.Add(MyConvert.Format("[{0}; {1}]", id.Query.FileScan.FirstScan, id.Charge));
                            }
                        }
                        finally
                        {
                            lbIdentified.EndUpdate();
                        }
                    }
                }
            }
        }
        private void lvPeptides_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lvPeptides.SelectedItems.Count > 0)
            {
                var spectrum = lvPeptides.SelectedItems[0].Tag as IIdentifiedSpectrum;
                var file     = ProteinChromatographProcessor.GetTargetFile(GetOriginFile(), rawFile.FullName, SpectrumToChro(spectrum));
                var chro     = new SimplePeakChroXmlFormat().ReadFromFile(file);

                try
                {
                    zgcScans.ClearData(false);

                    var mainPane = ZedGraphicExtension.InitMasterPanel(zgcScans, CreateGraphics(), 2, "Chromotograph");

                    if (chro.Peaks.Count > 0)
                    {
                        var pplSample = new PointPairList();
                        var pplppm    = new PointPairList();
                        var bFirst    = true;
                        foreach (ScanPeak p in chro.Peaks)
                        {
                            pplSample.Add(p.RetentionTime, p.Intensity);
                            pplppm.Add(p.RetentionTime, p.PPMDistance);
                            //if (p.Intensity > 0)
                            //{
                            //  pplSample.Add(p.RetentionTime, p.Intensity);
                            //  pplppm.Add(p.RetentionTime, p.PPMDistance);
                            //}
                            //else if (pplSample.Count > 0)
                            //{
                            //  if (bFirst)
                            //  {
                            //    mainPane.PaneList[0].AddCurve(MyConvert.Format("{0:0.0000},{1}", chro.Mz, chro.Charge), pplSample, Color.Red, SymbolType.None);
                            //    mainPane.PaneList[1].AddCurve(MyConvert.Format("{0:0.0000},{1}", chro.Mz, chro.Charge), pplppm, Color.Red, SymbolType.None);
                            //  }
                            //  else
                            //  {
                            //    mainPane.PaneList[0].AddCurve("a", pplSample, Color.Red, SymbolType.None);
                            //    mainPane.PaneList[1].AddCurve("a", pplppm, Color.Red, SymbolType.None);
                            //  }

                            //  pplSample.Clear();
                            //  pplppm.Clear();
                            //  bFirst = false;
                            //}
                        }

                        if (pplSample.Count > 0)
                        {
                            if (bFirst)
                            {
                                mainPane.PaneList[0].AddCurve(MyConvert.Format("{0:0.0000},{1}", chro.Mz, chro.Charge), pplSample, Color.Red, SymbolType.None);
                                mainPane.PaneList[1].AddCurve(MyConvert.Format("{0:0.0000},{1}", chro.Mz, chro.Charge), pplppm, Color.Red, SymbolType.None);
                            }
                            else
                            {
                                mainPane.PaneList[0].AddCurve("a", pplSample, Color.Red, SymbolType.None);
                                mainPane.PaneList[1].AddCurve("a", pplppm, Color.Red, SymbolType.None);
                            }
                        }
                    }
                }
                finally
                {
                    ZedGraphicExtension.UpdateGraph(zgcScans);
                }
            }
        }