Ejemplo n.º 1
0
        private void RefreshPlotsEventHandler(object sender, EventArgs e)
        {
            List <Series> tbrSeries     = Plot.Series.ToList();
            List <Series> tbrSeriesBool = PlotBool.Series.ToList();
            // Lets make a local copy (thread safety)
            IList <MeasurePoint> _mbData   = DriverContainer.Driver.MbData;
            IList <MeasurePoint> _mbAlarms = DriverContainer.Driver.MbAlarm;

            // If there are some plots on the graph
            if (tbrSeries.Count != 0)
            {
                Plotter.RefreshSeries(_mbData, tbrSeries);
                if (_showAlarms)
                {
                    Plotter.RefreshAnnotations(_mbAlarms, Plot, true);
                }
            }

            if (tbrSeriesBool.Count != 0)
            {
                Plotter.RefreshSeries(_mbData, tbrSeriesBool);
                if (_showAlarms)
                {
                    Plotter.RefreshAnnotations(_mbAlarms, PlotBool, false);
                }
            }

            Plot.InvalidatePlot(true);
            PlotBool.InvalidatePlot(true);
        }
Ejemplo n.º 2
0
        public void OnCheckedItemMessageReceived(EventWithMessage e)
        {
            // Lets make a local copy (thread safety)
            IList <MeasurePoint> _mbData  = DriverContainer.Driver.MbData;
            IList <MeasurePoint> myPoints = new List <MeasurePoint>();

            if (_mbData != null)
            {
                // The item was checked
                if (e.value == 1)
                {
                    myPoints = _mbData.Where(x => x.Reg_Name == e.name).ToList();
                    ShowPoints(myPoints);
                    Plot.InvalidatePlot(true);
                    PlotBool.InvalidatePlot(true);
                }
                else // The item was unchecked
                {
                    // Unplot
                    UnshowPoints(e.name);
                }

                IsExportDataEnabled = ((_plot.Series.Count() + _plotBool.Series.Count()) != 0) ? true : false;
            }
        }
Ejemplo n.º 3
0
 private void ConnectionStatusChangedEventHandler(object sender, EventArgs e)
 {
     if (!DriverContainer.Driver.IsConnected)
     {
         Plotter.ClearPoints(Plot);
         Plotter.ClearPoints(PlotBool);
         Plotter.ClearAnnotations(Plot);
         Plotter.ClearAnnotations(PlotBool);
         Plot.InvalidatePlot(true);
         PlotBool.InvalidatePlot(true);
         IsExportDataEnabled = false;
     }
 }
Ejemplo n.º 4
0
        public void UnshowPoints(string name)
        {
            Plotter.UnshowPoints(Plot, name);
            Plotter.UnshowPoints(PlotBool, name);

            // Delete Annotations too, if there are no more traces
            if (Plot.Series.ToList().Count == 0)
            {
                Plotter.ClearAnnotations(Plot);
            }
            if (PlotBool.Series.ToList().Count == 0)
            {
                Plotter.ClearAnnotations(PlotBool);
            }

            Plot.InvalidatePlot(true);
            PlotBool.InvalidatePlot(true);
        }
Ejemplo n.º 5
0
        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
                if (Plot.Series.ToList().Count > 0)
                {
                    Plotter.ClearAnnotations(Plot);
                }
                if (PlotBool.Series.ToList().Count > 0)
                {
                    Plotter.ClearAnnotations(PlotBool);
                }
                if (_mbAlarms != null)
                {
                    List <string> alarmNames = _mbAlarms.Select(x => x.Reg_Name).ToList().Distinct().ToList();
                    if (Plot.Series.ToList().Count > 0)
                    {
                        Plotter.ShowAnnotations(alarmNames, _mbAlarms, Plot, true);
                    }
                    if (PlotBool.Series.ToList().Count > 0)
                    {
                        Plotter.ShowAnnotations(alarmNames, _mbAlarms, PlotBool, false);
                    }
                }
            }
            else // unshow annotations
            {
                _showAlarms = false;
                Plotter.ClearAnnotations(Plot);
                Plotter.ClearAnnotations(PlotBool);
            }
            Plot.InvalidatePlot(true);
            PlotBool.InvalidatePlot(true);
        }