MouseTester.MousePlot.MousePlot C# (CSharp) Method

MousePlot() public method

public MousePlot ( MouseTester.MouseLog Mlog, MouseTester.MouseLog Mlog2, MouseTester.Settings settings ) : System
Mlog MouseTester.MouseLog
Mlog2 MouseTester.MouseLog
settings MouseTester.Settings
return System
        public MousePlot(MouseLog Mlog, MouseLog Mlog2, Settings settings)
        {
            this.settings = settings;

            InitializeComponent();

            this.mlog = Mlog;
            this.mlog2 = Mlog2;
            if (mlog2 != null && mlog2.Events.Count != 0)
                dual = true;

            IndexMouseLogs();

            this.last_start = 0;
            this.last_end = events.Count - 1;
            initialize_plot();

            GraphType[] grapthtypes =
            {
                new GraphType("xCount vs. Time", "Time (ms)", "xCounts", GraphType.GT.normal, plot_xcounts_vs_time),
                new GraphType("yCount vs. Time", "Time (ms)", "yCounts", GraphType.GT.normal, plot_ycounts_vs_time),
                new GraphType("xyCount vs. Time", "Time (ms)", "Counts", GraphType.GT.dual, plot_xycounts_vs_time),
                new GraphType("Interval vs. Time", "Time (ms)", "Update Time (ms)", GraphType.GT.normal, plot_interval_vs_time),
                new GraphType("Frequency vs. Time", "Time (ms)", "Frequency (Hz)", GraphType.GT.normal, plot_frequency_vs_time),
                new GraphType("xVelocity vs. Time", "Time (ms)", "xVelocity (m/s)", GraphType.GT.normal, plot_xvelocity_vs_time),
                new GraphType("yVelocity vs. Time", "Time (ms)", "yVelocity (m/s)", GraphType.GT.normal, plot_yvelocity_vs_time),
                new GraphType("xyVelocity vs. Time", "Time (ms)", "Velocity (m/s)", GraphType.GT.dual, plot_xyvelocity_vs_time),
                new GraphType("xSum vs. Time", "Time (ms)", "xSum (m/s)", GraphType.GT.normal, plot_xsum_vs_time),
                new GraphType("ySum vs. Time", "Time (ms)", "ySum (m/s)", GraphType.GT.normal, plot_ysum_vs_time),
                new GraphType("xySum vs. Time", "Time (ms)", "Sum (m/s)", GraphType.GT.dual, plot_xysum_vs_time),
                new GraphType("X vs. Y", "xCounts", "yCounts", GraphType.GT.nolines, plot_x_vs_y),
            };

            foreach (GraphType type in grapthtypes)
                comboBoxPlotType.Items.Add(type);

            this.comboBoxPlotType.SelectedIndex = 0;

            this.groupBox4.Enabled = dual;

            this.numericUpDownStart.Minimum = 0;
            this.numericUpDownStart.Maximum = last_end;
            this.numericUpDownStart.Value = last_start;
            this.numericUpDownStart.ValueChanged += new EventHandler(this.numericUpDownStart_ValueChanged);

            this.numericUpDownEnd.Minimum = 0;
            this.numericUpDownEnd.Maximum = last_end;
            this.numericUpDownEnd.Value = last_end;
            this.numericUpDownEnd.ValueChanged += new EventHandler(this.numericUpDownEnd_ValueChanged);

            checkBoxLines.Checked = settings.lines;
            checkBoxBgnd.Checked = settings.transparent;
            checkBoxSize.Checked = settings.fixedsize;
            checkBoxStem.Checked = settings.stem;

            if (settings.maximized)
                this.WindowState = FormWindowState.Maximized;
            else
            {
                Rectangle wa = Screen.PrimaryScreen.WorkingArea;

                if (settings.xpos + Size.Width > wa.Right)
                    settings.xpos = wa.Right - Size.Width;
                if (settings.ypos + Size.Height > wa.Bottom)
                    settings.ypos = wa.Bottom - Size.Height;

                if (settings.xpos < 0)
                    settings.xpos = 0;
                if (settings.ypos < 0)
                    settings.ypos = 0;

                this.Location = new Point(settings.xpos, settings.ypos);
            }

            if (settings.plotindex >= 0 && settings.plotindex < comboBoxPlotType.Items.Count)
                comboBoxPlotType.SelectedIndex = settings.plotindex;

            this.checkBoxLines.CheckedChanged += new EventHandler(this.Refresh_Plot_Helper);
            this.checkBoxStem.CheckedChanged += new EventHandler(this.Refresh_Plot_Helper);
            this.comboBoxPlotType.SelectedIndexChanged += new EventHandler(this.Refresh_Plot_Helper);
            refresh_plot();
        }