public void ShowPoints(IList <MeasurePoint> points, PlotModel pM) { // Let's make a local copy (thread safety) IList <MeasurePoint> _mbAlarms = DriverContainer.Driver.MbAlarm; if (IsFileLoaded == Visibility.Visible) { if (points != null && points.Any() && points.All(p => p != null)) { // Draw plot if (points[0].unit == N3PR_Data.PERCENTAGE) { Plotter.ShowPoints(points, pM, Plotter.SECONDARY_AXIS); } else { Plotter.ShowPoints(points, pM, Plotter.PRIMARY_AXIS); } // Annotate Alarms if (_showAlarms) { if (_mbAlarms != null) { List <string> alarmNames = _mbAlarms.Select(x => x.Reg_Name).ToList().Distinct().ToList(); Plotter.ShowAnnotations(alarmNames, _mbAlarms, pM, true); } } } } }
public void OnFlaggedAlarmMessageReceived(EventWithMessage e) { // Let's make a local copy (thread safety) IList <MeasurePoint> _mbAlarms = DriverContainer.Driver.MbAlarm; if (e.value == 1) // show annotations { _showAlarms = true; // Refresh Annotations Plotter.ClearAnnotations(Plot00); Plotter.ClearAnnotations(Plot01); Plotter.ClearAnnotations(Plot10); Plotter.ClearAnnotations(Plot11); if (_mbAlarms != null) { List <string> alarmNames = _mbAlarms.Select(x => x.Reg_Name).ToList().Distinct().ToList(); Plotter.ShowAnnotations(alarmNames, _mbAlarms, Plot00, true); Plotter.ShowAnnotations(alarmNames, _mbAlarms, Plot01, true); Plotter.ShowAnnotations(alarmNames, _mbAlarms, Plot10, true); Plotter.ShowAnnotations(alarmNames, _mbAlarms, Plot11, true); } } else // unshow annotations { _showAlarms = false; Plotter.ClearAnnotations(Plot00); Plotter.ClearAnnotations(Plot01); Plotter.ClearAnnotations(Plot10); Plotter.ClearAnnotations(Plot11); } Plot00.InvalidatePlot(true); Plot01.InvalidatePlot(true); Plot10.InvalidatePlot(true); Plot11.InvalidatePlot(true); }