private void timer1_Tick(object sender, EventArgs e) { float t1 = PCAS.get_box_temperature(); float t2 = PCAS.get_chip_temperature(); float m1 = PCAS.get_box_moisture(); float m2 = PCAS.get_chip_moisture(); if (t1 != float.NaN) { temperature1.Text = t1.ToString("0.00"); } if (t2 != float.NaN) { temperature0.Text = t2.ToString("0.00"); } if (m1 != float.NaN) { moisture1.Text = m1.ToString("0.00"); } if (m2 != float.NaN && m2 > 0 && m2 < 100) { moisture0.Text = m2.ToString("0.00"); } logtext.Text = PCAS.get_log(); logtext.Select(logtext.TextLength, 0); //光标定位到文本最后 logtext.ScrollToCaret(); //滚动到光标处 }
private void exam_Click(object sender, EventArgs e) { uint i = uint.Parse(sampleid.Text); uint sample = uint.Parse(Sample.Text); float d = float.Parse(sample_radius.Text); float a = float.Parse(angle.Text); if (i > sample) { MessageBox.Show("请输入正确的样本编号"); return; } if (a > 360 || a < -360) { MessageBox.Show("请输入正确的角偏移"); return; } if (d < 0 || d > 30) { MessageBox.Show("请输入正确的半径"); return; } PCAS.set_radius(d); PCAS.set_angle(a); PCAS.set_sample(sample); PCAS.move_to_sample(i); }
private void original_Click(object sender, EventArgs e) { checkBox0.Checked = false; checkBox1.Checked = false; checkBox2.Checked = false; checkBox3.Checked = false; PCAS.set_ref(4); }
private void LED_light_ValueChanged(object sender, EventArgs e) { uint i = decimal.ToUInt32(LED_light.Value); if (i > 100) { MessageBox.Show("请输入正确的亮度比列"); return; } PCAS.set_led(i); }
private void sample_exam_thread() { string strReadLine; string regexStr = @"[-+]?\b(?:[0-9]*\.)*[0-9]+\b"; MatchCollection mc; uint i = 1; PCAS.set_radius(d); PCAS.set_angle(a); PCAS.set_sample(sample); while (i < sample) { if (cycle == true) { PCAS.move_to_sample(i); } else { if (i > x.Count - 1) { break; } PCAS.microscopexy(x[(int)i], y[(int)i]); } this.set_sampleid(i.ToString()); Thread.Sleep(100); picture.Record_the_picture(i); Thread.Sleep(100); if (reportfile != null) { strReadLine = reportfile.ReadLine(); //读取每行数据 //while (!reportfile.EndOfStream) // strReadLine = reportfile.ReadLine(); //读取每行数据 if (strReadLine != null) { mc = Regex.Matches(strReadLine, regexStr); if (mc.Count >= 9) { dataGridView1[3, (int)i - 1].Value = mc[7].Value; } } } if (exam_start == false) { return; } Thread.Sleep(time); i++; } exam_start = false; set_exam("检测"); }
private void ypp_thread() { int i = 0; while (true) { PCAS.micoscope_y(100); i++; Thread.Sleep(100); if (ypp_stop == true) { return; } } }
private void zmm_thread() { int i = 0; while (true) { PCAS.micoscope_z(-100); i++; Thread.Sleep(100); if (zmm_stop == true) { return; } } }
private void button5_Click(object sender, EventArgs e) { int i = int.Parse(textBox2.Text); if (i == 0) { PCAS.microscopexy(0, 0); return; } i = i - 1; if (i > x.Count) { return; } PCAS.microscopexy(x[i], y[i]); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { uint uL; uint sampleid; if (e.RowIndex < 0 || e.ColumnIndex < 1) { return; } if (this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex - 1].Value != null) { uL = uint.Parse(this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex - 1].Value.ToString()); sampleid = (uint)e.RowIndex + 1; PCAS.set_hole_uL(uL); PCAS.move_to_hole(sampleid); } }
private void set_Click(object sender, EventArgs e) { float target_temp = float.Parse(targettemp.Text); float target_moist = float.Parse(targetmoist.Text); if (target_temp > 30 || target_temp < 0) { MessageBox.Show("请输入正确的温度"); return; } if (target_moist > 100 || target_moist < 0) { MessageBox.Show("请输入正确的湿度"); return; } PCAS.set_target_temperature(target_temp); PCAS.set_target_moisture(target_moist); }
private void cycle_thread() { int angle = 0; PCAS.micoscope_x(-r); while (angle < 360) { if (cycle_start == false) { return; } if (cycle_pause == true) { Thread.Sleep(1); continue; } PCAS.micoscope_x((int)(r - r * Math.Cos(Math.PI / 180 * angle))); PCAS.micoscope_y((int)(r * Math.Sin(Math.PI / 180 * angle))); angle++; } }
private void RemoteClose_Click(object sender, EventArgs e) { string username = UserName.Text; string password = PassWords.Text; string ipaddress = IPAddress0.Text + '.' + IPAddress1.Text + '.' + IPAddress2.Text + '.' + IPAddress3.Text; DialogResult r; r = MessageBox.Show("确认关机", "远程关机", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2); if (r == DialogResult.Cancel) { return; } if (PCAS.disconnect(ipaddress, username, password) == true) { welcome.Visible = true;// Set the welcome page as invisible timer1.Enabled = false; picture.Close(); } else { MessageBox.Show("关机失败"); } }
private void PreviewBox_MouseClick(object sender, MouseEventArgs e) { // 点击时记录坐标 int x = e.X; int y = e.Y; int w = PreviewBox.Width; int h = PreviewBox.Height; int ox = w / 2; int oy = h / 2; // 执行你的方法,无须模拟鼠标动作 if (m_hCamera <= 0) { return;//相机还未初始化,句柄无效 } int picture_w = m_tFrameHead.iWidth; int picture_h = m_tFrameHead.iHeight; int delta_x = (x - ox) * 1150 / 10 / w; // 2 * 500 / 710; int delta_y = (y - oy) * 800 / 10 / h; // 2 * 300 / 420; PCAS.micoscope_x(delta_x); PCAS.micoscope_y(delta_y); }
private void addsample_Click(object sender, EventArgs e) { uint i = uint.Parse(holeid.Text); uint sample = uint.Parse(Sample.Text); float d = float.Parse(radius.Text); float a = float.Parse(holeangle.Text); float h_d = float.Parse(hole_off.Text); float u = float.Parse(uL.Text); if (i > sample) { MessageBox.Show("请输入正确的样本编号"); return; } if (a > 360 || a < -360) { MessageBox.Show("请输入正确的角偏移"); return; } if (d < 0 || d > 30) { MessageBox.Show("请输入正确的半径"); return; } if (h_d < 0 || h_d > 50) { MessageBox.Show("请输入正确的偏移"); return; } PCAS.set_hole_radius(d); PCAS.set_hole_angle(a); PCAS.set_hole_sample(sample); PCAS.set_hole_delta(h_d); PCAS.set_hole_uL(u); PCAS.move_to_hole(i); }
private void ConnectButton_Click(object sender, EventArgs e) { string username = UserName.Text; string password = PassWords.Text; string ipaddress = IPAddress0.Text + '.' + IPAddress1.Text + '.' + IPAddress2.Text + '.' + IPAddress3.Text; if (PCAS.connect(ipaddress, username, password)) { float t1 = PCAS.get_box_temperature(); float t2 = PCAS.get_chip_temperature(); float m1 = PCAS.get_box_moisture(); float m2 = PCAS.get_chip_moisture(); welcome.Visible = false;// Set the welcome page as invisible timer1.Enabled = true; temperature1.Text = t1.ToString(); temperature0.Text = t2.ToString(); moisture0.Text = m1.ToString(); moisture1.Text = m2.ToString(); } else { MessageBox.Show("连接失败"); } }
private void zpp_Click(object sender, EventArgs e) { PCAS.micoscope_z(100); }
private void button16_Click(object sender, EventArgs e) { PCAS.set_view_z(); }
private void button17_Click(object sender, EventArgs e) { PCAS.set_hole_z(); }
private void button2_Click(object sender, EventArgs e) { PCAS.pannel_out(); }
private void button1_Click(object sender, EventArgs e) { PCAS.pannel_in(); }
private void xp_Click(object sender, EventArgs e) { PCAS.micoscope_x(1); }
private void AlignmentMark3_Click(object sender, EventArgs e) { checkBox3.Checked = true; PCAS.set_ref(3); }
private void sybb_Click(object sender, EventArgs e) { PCAS.syringe_minus(200); }
private void syff_Click(object sender, EventArgs e) { PCAS.syringe_plus(200); }
private void xmm_Click(object sender, EventArgs e) { PCAS.micoscope_x(-100); }
private void yp_Click(object sender, EventArgs e) { PCAS.micoscope_y(-1); }
private void zm_Click(object sender, EventArgs e) { PCAS.micoscope_z(-10); }