Ejemplo n.º 1
0
        private void OnPlotButtonPressed(object sender, EventArgs e)
        {
            if (_sensorDropdown.Active != -1)
            {
                string selected = _sensorDropdown.ActiveText;
                if (_data.Values.ContainsKey(selected))
                {
                    _plot.Points = _data.ToPoints(selected);
                    _plot.YLabel = selected;

                    float xmin, xmax, ymin, ymax;
                    try
                    {
                        xmin = Convert.ToSingle(_xminEntry.Text);
                    } catch (Exception)
                    {
                        ErrorDialog(string.Format("The input {0} in X Min could not be converted to float", _xminEntry.Text));
                        return;
                    }

                    try
                    {
                        xmax = Convert.ToSingle(_xmaxEntry.Text);
                    }
                    catch (Exception)
                    {
                        ErrorDialog(string.Format("The input {0} in X Max could not be converted to float", _xmaxEntry.Text));
                        return;
                    }

                    try
                    {
                        ymin = Convert.ToSingle(_yminEntry.Text);
                    }
                    catch (Exception)
                    {
                        ErrorDialog(string.Format("The input {0} in Y Min could not be converted to float", _yminEntry.Text));
                        return;
                    }

                    try
                    {
                        ymax = Convert.ToSingle(_ymaxEntry.Text);
                    }
                    catch (Exception)
                    {
                        ErrorDialog(string.Format("The input {0} in Y Max could not be converted to float", _ymaxEntry.Text));
                        return;
                    }

                    _plot.Xmin = xmin;
                    _plot.Xmax = xmax;
                    _plot.Ymin = ymin;
                    _plot.Ymax = ymax;
                    _plot.Paint();
                }
            }
        }