Esempio n. 1
0
        public static Settings Read(IniFile ini)
        {
            Settings result = new Settings();
            result.lines = ToBoolean(ini.Read("Lines", "Config"), false);
            result.stem = ToBoolean(ini.Read("Stem", "Config"), false);
            result.transparent = ToBoolean(ini.Read("Transparent", "Config"), true);
            result.fixedsize = ToBoolean(ini.Read("FixedSize", "Config"), true);

            result.maximized = ToBoolean(ini.Read("Maximized", "Config"), true);

            result.plotindex = -1;
            int.TryParse(ini.Read("Plot", "Config"), out result.plotindex);

            int.TryParse(ini.Read("XPos", "Config"), out result.xpos);
            int.TryParse(ini.Read("YPos", "Config"), out result.ypos);

            bool res1 = double.TryParse(ini.Read("CPI1", "Config"), NumberStyles.Float, CultureInfo.InvariantCulture, out result.cpi1);
            double.TryParse(ini.Read("CPI2", "Config"), NumberStyles.Float, CultureInfo.InvariantCulture, out result.cpi2);

            result.desc1 = ini.Read("Desc1", "Config");
            result.desc2 = ini.Read("Desc2", "Config");

            if (result.desc1 == "")
                result.desc1 = "MouseTester";
            if (result.desc2 == "")
                result.desc2 = "MouseTester";

            return result;
        }
Esempio n. 2
0
        public Form1()
        {
            InitializeComponent();
            try
            {
                Process.GetCurrentProcess().ProcessorAffinity = new IntPtr(2); // Use only the second core
                Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime; // Set highest process priority
                Thread.CurrentThread.Priority = ThreadPriority.Highest; // Set highest thread priority
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }

            this.tabControl1.TabPages.RemoveAt(1);

            this.mlog = this.mlog1;
            this.textBoxCPI = textBoxCPI1;
            this.textBoxDesc = textBoxDesc1;

            this.mouse.RegisterRawInputMouse(Handle);
            this.mouse.mevent += new RawMouse.MouseEventHandler(this.logMouseEvent);

            this.textBox1.Text = "Enter the correct CPI" +
                                 "\r\n        or\r\n" +
                                 "Press the Measure button" +
                                 "\r\n        or\r\n" +
                                 "Press the Load button";
            this.toolStripStatusLabel1.Text = "";

            configini = new IniFile("config.ini");
            settings = Settings.Read(configini);

            this.mlog1.Cpi = settings.cpi1;
            this.mlog2.Cpi = settings.cpi2;
            this.mlog1.Desc = settings.desc1;
            this.mlog2.Desc = settings.desc2;

            this.textBoxDesc1.Text = this.mlog1.Desc.ToString();
            this.textBoxCPI1.Text = this.mlog1.Cpi.ToString();
            this.textBoxDesc2.Text = this.mlog2.Desc.ToString();
            this.textBoxCPI2.Text = this.mlog2.Cpi.ToString();
        }
Esempio n. 3
0
        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();
        }