protected virtual void OnDataPointDataPointSelectionChanging(DataPointSelectionChangingEventArgs e) { if (this.DataPointSelectionChanging == null) { return; } this.DataPointSelectionChanging((object)this, e); }
internal void FireDataPointSelectionChanging(DataPoint dataPoint, bool addToSelection) { if (!this.IsMouseSelectionEnabled || dataPoint != null && !Enumerable.Contains <Series>(this.GetSeries(), dataPoint.Series)) { return; } this.SuspendSelectionChangedEvents(); try { if (dataPoint == null) { DataPointSelectionChangingEventArgs e = new DataPointSelectionChangingEventArgs((IList <DataPoint>)Enumerable.ToList <DataPoint>(this.GetSelectedDataPoints()), (IList <DataPoint>)null); this.OnDataPointDataPointSelectionChanging(e); if (e.Cancel) { return; } this.ClearSelectedDataPoints(); } else { List <DataPoint> list1 = new List <DataPoint>(); List <DataPoint> list2 = new List <DataPoint>(); if (!dataPoint.IsSelected) { list2.Add(dataPoint); } else if (addToSelection) { list1.Add(dataPoint); } if (!addToSelection) { list1 = Enumerable.ToList <DataPoint>(Enumerable.Where <DataPoint>(this.GetSelectedDataPoints(), (Func <DataPoint, bool>)(p => { if (p == dataPoint) { return(dataPoint.IsSelected); } return(true); }))); } DataPointSelectionChangingEventArgs e = new DataPointSelectionChangingEventArgs((IList <DataPoint>)list1, (IList <DataPoint>)list2); this.OnDataPointDataPointSelectionChanging(e); if (e.Cancel) { return; } list1.ForEach((Action <DataPoint>)(p => p.IsSelected = false)); list2.ForEach((Action <DataPoint>)(p => p.IsSelected = true)); } } finally { this.ReleaseSelectionChangedEvents(); } }