/// <summary> /// 高度标定计算 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonHeightCalibCalc_Click(object sender, EventArgs e) { var platform = comboBoxPlatformCalib.Text; if (platform != "Left" && platform != "Right") { MessageBox.Show($"标定平台{platform}选择错误!"); return; } try { var calib = AutoPlatformHeightCalib.CreateHeightCalib(platform); if (calib != null) { if (calib.Station.RunningState != RunningState.WaitRun) { throw new Exception($"{calib.Station.Name} not ready"); } calib.LogEvent += (log, level) => { LoggerHelper.Log(@".\Calib", log, level); }; calib.PlatformCarrier = null; calib.Platform1 = null; calib.Platform2 = null; calib.GtController = null; calib.do_clampy_cy = null; calib.do_gt2_cy = null; calib.DoCalib(); richTextBoxCalib.AppendText(calib.DisplayOutput()); AutoPlatformHeightCalib.SaveHeightCalib(calib); } } catch (Exception ex) { MessageBox.Show($"{platform} 高度标定计算异常:{ex.Message}"); } }
/// <summary> /// 高度标定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonHeightCalib_Click(object sender, EventArgs e) { var platform = comboBoxPlatformCalib.Text; if (platform != "Left" && platform != "Right") { MessageBox.Show($"标定平台{platform}选择错误!"); return; } try { var calib = AutoPlatformHeightCalib.CreateHeightCalib(platform); if (calib != null) { Action <string, LogLevel> logeventDelegate = (log, level) => { LoggerHelper.Log(@".\Calib", log, level); }; calib.LogEvent += logeventDelegate; var calibForm = new AutoCalibForm { Calib = calib }; if (calibForm.ShowDialog() == DialogResult.OK) { var ret = calibForm.Calib as AutoPlatformHeightCalib; if (ret != null) { AutoPlatformHeightCalib.SaveHeightCalib(ret); } richTextBoxCalib.AppendText(calib.DisplayOutput()); } calib.LogEvent -= logeventDelegate; } } catch (Exception ex) { MessageBox.Show($"{platform} 高度标定异常:{ex.Message}"); } }