protected void OnUpdateProductIon(UpdateMRMPairedProductIonEventArgs e)
 {
     if (ProductIonUpdate != null)
     {
         ProductIonUpdate(this, e);
     }
 }
        private void DoUpdateFileModeProductIon()
        {
            var fileItem = GetFileModeItem();

            fileItem.PairedPeptide.ProductIonPairs.ForEach(m => m.IsCurrent = m == fileItem.PairedProductIon);

            UpdateMRMPairedProductIonEventArgs args = new UpdateMRMPairedProductIonEventArgs(fileItem.PairedProductIon, viewOption);

            OnUpdateFileModeProductIon(args);
        }
        public void Update(object sender, UpdateMRMPairedProductIonEventArgs e)
        {
            var summary = e.Item;

            if (summary == null)
            {
                throw new ArgumentNullException("UpdateMRMItemEventArgs.Item cannot be null");
            }

            panel.Tag = e.Item;

            panel.ClearData();
            try
            {
                if (summary.Heavy != null)
                {
                    var pplRed = new PointPairList();
                    var noise  = summary.DeductBaseLine ? summary.Light.Noise : 0.0;
                    for (int i = 0; i < summary.Light.Intensities.Count; i++)
                    {
                        if (summary.Light.Intensities[i].Enabled)
                        {
                            pplRed.Add(new PointPair(summary.Heavy.Intensities[i].Intensity - noise, summary.Light.Intensities[i].Intensity - noise, 0.0, i));
                        }
                    }
                    ;

                    if (pplRed.Count > 0)
                    {
                        panel.AddPoints(pplRed, Color.Red);
                        PointPairList line = ZedGraphicExtension.GetRegressionLine(pplRed, summary.Ratio, summary.Distance);
                        panel.AddCurve(null, line, Color.Green, SymbolType.None);
                        panel.Title.Text      = summary.GetFormula();
                        panel.Title.IsVisible = true;
                    }
                    else
                    {
                        panel.Title.IsVisible = false;
                    }
                }
            }
            finally
            {
                ZedGraphicExtension.UpdateGraph(this.zgcGraph);
            }
        }
        private SrmPairedProductIon DoUpdateProductIon()
        {
            var pep = GetPeptide();

            if (pep == null)
            {
                return(null);
            }

            CurrencyManager     cm   = (CurrencyManager)this.BindingContext[pep.ProductIonPairs];
            SrmPairedProductIon item = cm.Current as SrmPairedProductIon;
            UpdateMRMPairedProductIonEventArgs args = new UpdateMRMPairedProductIonEventArgs(item, new SrmViewOption()
            {
                ViewGreenLine = true, ViewType = lastType
            });

            OnUpdateProductIon(args);

            return(item);
        }
        public void Update(object sender, UpdateMRMPairedProductIonEventArgs e)
        {
            var summary = e.Item;

            if (summary == null)
            {
                throw new ArgumentNullException("UpdateMRMPairedProductIonEventArgs.Item cannot be null");
            }

            MasterPane myMaster = zgcGraph.MasterPane;

            myMaster.Border.IsVisible = false;
            myMaster.PaneList.Clear();
            try
            {
                myMaster.Margin.All   = 10;
                myMaster.InnerPaneGap = 10;

                // Set the master pane title
                myMaster.Title.Text       = MyConvert.Format("{0:0.0000} - {1:0.0000}", summary.Light == null ? 0.0 : summary.Light.PrecursorMZ, summary.Heavy == null ? 0.0 : summary.Heavy.PrecursorMZ);
                myMaster.Title.IsVisible  = true;
                myMaster.Legend.IsVisible = false;

                myMaster.Add(new GraphPane());
                myMaster.Add(new GraphPane());

                new ZedGraphMRMProductIonScans(zgcGraph, myMaster.PaneList[0]).Update(null, e);
                new ZedGraphMRMRegression(zgcGraph, myMaster.PaneList[1]).Update(null, e);

                myMaster.SetLayout(g, PaneLayout.SingleRow);
                zgcGraph.AxisChange();
            }
            finally
            {
                ZedGraphicExtension.UpdateGraph(this.zgcGraph);
            }
        }
        public void Update(object sender, UpdateMRMPairedProductIonEventArgs e)
        {
            panel.ClearData();

            var summary = e.Item;

            if (summary == null)
            {
                return;
            }

            var option = e.ViewOption;

            panel.Tag = summary;

            panel.ClearData();
            try
            {
                var    enabledCount = summary.EnabledScanCount;
                double maxLightIntensity, maxHeavyIntensity;
                if (enabledCount == 0)
                {
                    maxLightIntensity = summary.LightMaxIntensity;
                    maxHeavyIntensity = summary.HeavyMaxIntensity;
                }
                else
                {
                    maxLightIntensity = summary.LightMaxEnabledIntensity;
                    maxHeavyIntensity = summary.HeavyMaxEnabledIntensity;
                }
                var maxIntensity = Math.Max(maxLightIntensity, maxHeavyIntensity);

                if (summary.IsCurrent && option.ViewCurrentHighlight)
                {
                    panel.Chart.Fill = new Fill(Color.Cornsilk);
                }
                else
                {
                    panel.Chart.Fill = new Fill(Color.Transparent);
                }

                if (summary.Light != null && summary.Heavy != null && !option.ViewGreenLine)
                {
                    AddAbsoluteCurve(summary.Light, "Light", Color.Blue, DashStyle.Solid);
                    AddAbsoluteCurve(summary.Heavy, "Heavy", Color.Red, DashStyle.Dot);
                }
                else
                {
                    if (summary.Light != null)
                    {
                        AddAbsoluteCurve(summary.Light, "Light", Color.Blue, DashStyle.Solid);
                    }

                    if (summary.Heavy != null)
                    {
                        AddAbsoluteCurve(summary.Heavy, "Heavy", Color.Red, DashStyle.Solid);
                    }

                    if (option.ViewGreenLine)
                    {
                        if ((maxLightIntensity > maxHeavyIntensity) && (summary.Heavy != null))
                        {
                            AddAbsoluteCurve2(summary.Heavy, maxLightIntensity * 0.9 / maxHeavyIntensity, Color.Green);
                        }
                        else if (summary.Light != null)
                        {
                            AddAbsoluteCurve2(summary.Light, maxHeavyIntensity * 0.9 / maxLightIntensity, Color.Green);
                        }
                    }
                }

                var filename = string.IsNullOrEmpty(summary.FileName) ? "" : summary.FileName + "; ";
                if (summary.IsPaired)
                {
                    this.panel.Title.Text = filename + summary.GetFormula() + "\n" + summary.GetSignalToNoise();
                }
                else
                {
                    this.panel.Title.Text = filename + summary.GetSignalToNoise();
                }

                this.panel.Title.IsVisible = true;
                this.panel.YAxis.Scale.Min = 0;

                if (option.ViewType == DisplayType.PerfectSize || option.ViewType == DisplayType.FullHeight)
                {
                    var range = (from scan in summary.Light.Intensities
                                 where scan.Enabled
                                 orderby scan.RetentionTime
                                 select scan.RetentionTime).ToList();

                    if (range.Count > 0)
                    {
                        var minRt = range.First() - 1;
                        var maxRt = range.Last() + 1;

                        panel.XAxis.Scale.Min = minRt;
                        panel.XAxis.Scale.Max = maxRt;
                    }

                    if (option.ViewType == DisplayType.PerfectSize)
                    {
                        panel.YAxis.Scale.Max = maxIntensity * 1.2;
                    }
                }
            }
            finally
            {
                ZedGraphicExtension.UpdateGraph(this.zgcGraph);
            }
        }