void frmfaults_onClearCurrentDTC(object sender, frmFaultcodes.ClearDTCEventArgs e) { // clear the currently selected DTC code from the ECU if (e.DTCCode.StartsWith("P")) { try { int DTCCode = Convert.ToInt32(e.DTCCode.Substring(1, e.DTCCode.Length - 1), 16); //TODO ClearDTCCodes() must be added to the api //t8can.ClearDTCCodes(DTCCode); if (sender is frmFaultcodes) { frmFaultcodes frmfaults = (frmFaultcodes)sender; frmfaults.ClearCodes(); string[] faults = null;//t8can.ReadDTC(); foreach (string fault in faults) { frmfaults.addFault(fault.Substring(5, 5)); } frmfaults.Show(); } } catch (Exception E) { mLogger.Debug(E.Message); } } }
private void btnReadFaultCodes_ItemClick(object sender, ItemClickEventArgs e) { // Connect at accesslevel01, need to close connection if already open if (m_connectedToECU) { t8can.Cleanup(); m_connectedToECU = false; } SetCanAdapter(); t8can.SecurityLevel = AccessLevel.AccessLevel01; t8can.openDevice(false); frmFaultcodes frmfaults = new frmFaultcodes(); frmfaults.onClearCurrentDTC += new frmFaultcodes.onClearDTC(frmfaults_onClearCurrentDTC); frmfaults.onCloseFrm += new frmFaultcodes.frmClose(frmfaults_onClose); string[] faults = t8can.ReadDTC(); foreach (string fault in faults) { frmfaults.addFault(fault.Substring(5,5)); } frmfaults.Show(); }