private void timerHighVoltage_10min_Timeout(object sender, EventArgs e) { timerHighVoltage_10min.Enabled = false; myUart.Pack_Debug_out(null, "HV 10min timeout" + "]"); myApi.SendHighVoltageDown(0, 0); timerUartRecv.Interval = 1000 * 10; timerUartRecv.Enabled = true; }
private void buttonCancel_Click(object sender, EventArgs e) { try { myUart.Pack_Debug_out(null, "[HighVoltage] voltage close"); sendVoltage = 0; sendCurrent = 0; myApi.SendHighVoltageDown(sendVoltage, sendCurrent); timerUartRecv.Interval = 1000 * 10; timerUartRecv.Enabled = true; } catch (Exception ex) { myUart.Pack_Debug_out(null, "Exception" + "[" + ex.ToString() + "]"); } }
private void FormMDIParent_FormClosing(object sender, FormClosingEventArgs e) { myUart.Pack_Debug_out(null, "[Parent] closing"); if ((showVoltage > 0) || (showCurrent > 0)) { FormHighVoltageConfirm form = new FormHighVoltageConfirm(showVoltage, showCurrent); form.StartPosition = FormStartPosition.CenterScreen; DialogResult result = form.ShowDialog(); if (result == DialogResult.OK) { //e.Cancel = true; myApi.SendHighVoltageDown(0, 0); } else { } } else { } }
public void UartRecv_DeviceError(byte[] text, int PackageLen) { bool result = false; int LastSendCmd = myApi.CurrentSendCmd; try { string strRecvData = System.Text.Encoding.Default.GetString(text); int index = strRecvData.IndexOf("**"); if (index >= 0) { timerUartRecv.Enabled = false; myApi.SDD_ErrorState = true; myApi.SDD_ErrorString = strRecvData.Remove(0, index); myApi.SendDevicePause(); timerUartRecv.Interval = 1000 * 5; timerUartRecv.Enabled = true; myUart.Pack_Debug_out(text, "Recv Device Error" + "[" + strRecvData + "]"); } else { if (DEVICE_CMD_ID.SET_DEV_PAUSE == LastSendCmd) { result = myApi.RecvDeviceReady(text); if (result) { timerUartRecv.Enabled = false; myApi.SendCloseShutter(); timerUartRecv.Interval = 1000 * 5; timerUartRecv.Enabled = true; } } else if (DEVICE_CMD_ID.CLOSE_LIGHT_SHUTTER == LastSendCmd) { result = myApi.RecvDeviceReady(text); if (result) { timerUartRecv.Enabled = false; myApi.SendHighVoltageDown(myApi.DefaultVotage, myApi.DefaultCurrent); timerUartRecv.Interval = 1000 * 10; timerUartRecv.Enabled = true; } } else if (DEVICE_CMD_ID.SET_HIGH_VOLTAGE_DOWN == LastSendCmd) { result = myApi.RecvDeviceReady(text); if (result) { timerUartRecv.Enabled = false; showErrorMessageBox(myApi.SDD_ErrorString); myApi.SDD_ErrorState = false; myApi.SDD_ErrorString = ""; } } else { } } } catch (Exception ex) { myUart.Pack_Debug_out(null, "Exception" + "[" + ex.ToString() + "]"); } }