private void bt_startCalibration_Click(object sender, EventArgs e) { classCalibrationInfo.DetectFlag = true; classCalibrationInfo.InitDetectTread(); //wait to finish the detect. while (!classCalibrationInfo.EndDetectEvent) { Application.DoEvents(); } if (classCalibrationInfo.DpCountAxist > 0) { classCalibrationInfo.EndDetectEvent = false; UpdateDeviceTable(); classDpCommunication.SendStartCalibration(); classCalibrationInfo.ResetStateMachine(); classCalibrationInfo.DoCalibration = true; classCalibrationInfo.CalibrationPaused = false; classCalibrationInfo.InitCalibTread(); classCalibrationInfo.CreateLogFiles(); ClearColorIndication(); } else { MessageBox.Show("No exist dp devices!"); } }
private void bt_startCalibration_Click(object sender, EventArgs e) { bt_startCalibration.Enabled = false; threads_stopped = false; update_thread = new Thread(timer_update_thread); update_thread.Start(); if (ValidStationAccess()) { try { //check connection to database..... int userId = RIT_QA.ClassDal.GetFirstUserID(); if (Properties.Settings.Default.DebugMode == false) { if (classCalibrationInfo.DpCountExist > 0 && classCalibrationInfo.classCalibrationSettings.PressureUnderTestList.Count > 0 && classCalibrationInfo.classCalibrationSettings.TempUnderTestList.Count > 0 && classCalibrationInfo.classCalibrationSettings.Versions.DpFw != "") { UpdateDeviceTable(); //classDpCommunication.SendStartCalibration(); classCalibrationInfo.ResetStateMachine(); classCalibrationInfo.DoCalibration = true; classCalibrationInfo.CalibrationPaused = false; classCalibrationInfo.InitCalibTread(); classCalibrationInfo.CreateLogFiles(); ClearColorIndication(); bt_stopCalibration.Enabled = true; bt_pauseStartCalib.Enabled = true; ScanButton.Enabled = false; } else { if (classCalibrationInfo.DpCountExist == 0) { MessageBox.Show("No DPS devices found!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0x40000); } else if (classCalibrationInfo.classCalibrationSettings.PressureUnderTestList.Count == 0) { MessageBox.Show("Load configuration file before you calibration start", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0x40000); } else if (classCalibrationInfo.classCalibrationSettings.TempUnderTestList.Count == 0) { MessageBox.Show("Load configuration file before you calibration start", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0x40000); } bt_startCalibration.Enabled = true; } } } catch (Exception ex) { if (ex.InnerException != null) { rtb_info.AppendText(ex.StackTrace.ToString() + "\r\n\r\n" + ex.InnerException.ToString() + ".\r\n\r\n"); Logger.Error("Faile to add table to database. " + ex.StackTrace.ToString() + " " + ex.InnerException.ToString()); } } } else { DialogResult result = MessageBox.Show("Enter User name and Station id in config Form", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0x40000); } }