private void buttonCalib100A_Click(object sender, EventArgs e) { // Send commands for calibration CommandFormerClass cm = new CommandFormerClass(ConfigClass.startSeq, ConfigClass.deviceAddr); cm.ReturnACK(); cm.AppendDischarger100AOn(); cm.AppendWaitForMs(2000); cm.AppendDataRecorderTask(0, 2, 0, 150, DateTime.Now.AddSeconds(2)); // Take into consideration 2 sec wait above cm.AppendWaitForMs(1000); cm.AppendDischarger100AOffS1(); cm.AppendWaitForMs(200); cm.AppendDischarger100AOffS2(); var data = cm.GetFinalCommandList(); SerialDriver.Send(data, SuccessCallbackCurrent100A, FailCallback); // Now enable GW INSTEC recording Point pt = new Point(Convert.ToInt32(dataGridView1.Rows[0].Cells[0].Value), Convert.ToInt32(dataGridView1.Rows[0].Cells[1].Value)); Cursor.Position = pt; mouse_event(MOUSEEVENTF_LEFTDOWN, pt.X, pt.Y, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, pt.X, pt.Y, 0, 0); Thread.Sleep(100); // Configrm recording pt = new Point(Convert.ToInt32(dataGridView1.Rows[1].Cells[0].Value), Convert.ToInt32(dataGridView1.Rows[1].Cells[1].Value)); Cursor.Position = pt; mouse_event(MOUSEEVENTF_LEFTDOWN, pt.X, pt.Y, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, pt.X, pt.Y, 0, 0); Thread.Sleep(2900); // Disable measures pt = new Point(Convert.ToInt32(dataGridView1.Rows[0].Cells[0].Value), Convert.ToInt32(dataGridView1.Rows[0].Cells[1].Value)); Cursor.Position = pt; mouse_event(MOUSEEVENTF_LEFTDOWN, pt.X, pt.Y, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, pt.X, pt.Y, 0, 0); }
private void buttonDebugWaitForMs_Click(object sender, EventArgs e) { UInt32 ms; try { ms = Convert.ToUInt32(textBoxDebugWaitInMiliseconds.Text); } catch (Exception) { MessageBox.Show("Insert valid number for delay!"); return; } com.AppendWaitForMs(ms); textBoxDebugInstructionPool.Text += "Delay in ms: " + ms.ToString() + "\r\n"; FormCustomConsole.WriteLine("Delay in ms: " + ms.ToString()); }